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.
  • 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.