Package org.eclipse.ui.internal

# Class UILockListener

java.lang.Object
org.eclipse.core.runtime.jobs.LockListener
org.eclipse.ui.internal.UILockListener

public class UILockListener extends LockListener
The UI lock listener is used to prevent the UI thread from deadlocking on a lock when the thread owning the lock is attempting to syncExec.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`UILockListener.Queue`
The Queue is the construct that keeps track of Semaphores.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected PendingSyncExec`
`currentWork`
`protected Display`
`display`
`protected final UILockListener.Queue`
`pendingWork`
`protected Thread`
`ui`
Points to the UI thread if it is currently waiting on a lock or null

## Constructor Summary

Constructors
Constructor
Description
`UILockListener(Display display)`
Create a new instance of the receiver.

## Method Summary

Modifier and Type
Method
Description
`void`
`aboutToRelease()`
Notification that a thread is about to release a lock.
`boolean`
`aboutToWait(Thread lockOwner)`
Notification that a thread is about to block on an attempt to acquire a lock.
`boolean`
`canBlock()`
Returns if it is safe for the calling thread to block while waiting to obtain a lock.

### Methods inherited from class org.eclipse.core.runtime.jobs.LockListener

`isLockOwnerThread`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### display

protected Display display

### pendingWork

protected final UILockListener.Queue pendingWork

### currentWork

protected PendingSyncExec currentWork

### ui

protected volatile Thread ui
Points to the UI thread if it is currently waiting on a lock or null

## Constructor Details

### UILockListener

public UILockListener(Display display)
Create a new instance of the receiver.

## Method Details

### aboutToRelease

public void aboutToRelease()
Description copied from class: `LockListener`
Notification that a thread is about to release a lock.

This default implementation does nothing. Subclasses may override.

Overrides:
  `aboutToRelease` in class `LockListener`

### aboutToWait

public boolean aboutToWait(Thread lockOwner)
Description copied from class: `LockListener`
Notification that a thread is about to block on an attempt to acquire a lock. Returns whether the thread should be granted immediate access to the lock.

This default implementation always returns `false`. Subclasses may override.

Overrides:
  `aboutToWait` in class `LockListener`
Parameters:
  `lockOwner` - the thread that currently owns the lock this thread is waiting for, or `null` if unknown.
Returns:
  `true` if the thread should be granted immediate access, and `false` if it should wait for the lock to be available

### canBlock

public boolean canBlock()
Description copied from class: `LockListener`
Returns if it is safe for the calling thread to block while waiting to obtain a lock. When blocking in the calling thread is not safe, the caller will ensure that the thread is kept alive and responsive to cancellation while waiting.

Overrides:
  `canBlock` in class `LockListener`
Returns:
  `true` if this thread can block, and `false` otherwise.