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
Modifier and TypeClassDescriptionstatic class
The Queue is the construct that keeps track of Semaphores. -
Field Summary
Modifier and TypeFieldDescriptionprotected PendingSyncExec
protected Display
protected final UILockListener.Queue
protected Thread
Points to the UI thread if it is currently waiting on a lock or null -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
-
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:LockListener
Notification that a thread is about to release a lock.This default implementation does nothing. Subclasses may override.
- Overrides:
aboutToRelease
in classLockListener
-
aboutToWait
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 classLockListener
- Parameters:
lockOwner
- the thread that currently owns the lock this thread is waiting for, ornull
if unknown.- Returns:
true
if the thread should be granted immediate access, andfalse
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 classLockListener
- Returns:
true
if this thread can block, andfalse
otherwise.
-