Package org.eclipse.ui.internal
Class UILockListener
java.lang.Object
org.eclipse.core.runtime.jobs.LockListener
org.eclipse.ui.internal.UILockListener
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 ClassesModifier and TypeClassDescriptionstatic classThe Queue is the construct that keeps track of Semaphores. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PendingSyncExecprotected Displayprotected final UILockListener.Queueprotected ThreadPoints to the UI thread if it is currently waiting on a lock or null -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidNotification that a thread is about to release a lock.booleanaboutToWait(Thread lockOwner) Notification that a thread is about to block on an attempt to acquire a lock.booleancanBlock()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
-
Field Details
-
display
-
pendingWork
-
currentWork
-
ui
Points to the UI thread if it is currently waiting on a lock or null
-
-
Constructor Details
-
UILockListener
Create a new instance of the receiver.
-
-
Method Details
-
aboutToRelease
public void aboutToRelease()Description copied from class:LockListenerNotification that a thread is about to release a lock.This default implementation does nothing. Subclasses may override.
- Overrides:
aboutToReleasein classLockListener
-
aboutToWait
Description copied from class:LockListenerNotification 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:
aboutToWaitin classLockListener- Parameters:
lockOwner- the thread that currently owns the lock this thread is waiting for, ornullif unknown.- Returns:
trueif the thread should be granted immediate access, andfalseif it should wait for the lock to be available
-
canBlock
public boolean canBlock()Description copied from class:LockListenerReturns 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:
canBlockin classLockListener- Returns:
trueif this thread can block, andfalseotherwise.
-