Class ManualResetEvent

java.lang.Object
co.yellowdog.platform.clients.objectstore.ManualResetEvent

public class ManualResetEvent extends Object
Represents a thread synchronization event that, when signaled, must be reset manually.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initialises a new instance of ManualResetEvent with the initial state of closed.
    ManualResetEvent(boolean open)
    Initialises a new instance of ManualResetEvent with the specified initial state.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Resets the event signal, such that any further calls to waitOne() will cause threads to block until the event is set() again.
    void
    set()
    Signals the event, unblocking all waiting threads.
    void
    Blocks the calling thread until the event is signalled.
    boolean
    waitOne(long milliseconds)
    Blocks the calling thead until either the event is signalled or the specified timeout is reached.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ManualResetEvent

      public ManualResetEvent()
      Initialises a new instance of ManualResetEvent with the initial state of closed.
    • ManualResetEvent

      public ManualResetEvent(boolean open)
      Initialises a new instance of ManualResetEvent with the specified initial state.
      Parameters:
      open - true, to allow threads to continue; false, to block threads until signalled.
  • Method Details

    • waitOne

      public void waitOne() throws InterruptedException
      Blocks the calling thread until the event is signalled.
      Throws:
      InterruptedException - if the thread is interrupted
    • waitOne

      public boolean waitOne(long milliseconds) throws InterruptedException
      Blocks the calling thead until either the event is signalled or the specified timeout is reached.
      Parameters:
      milliseconds - the length of time to wait, in milliseconds
      Returns:
      true, if the event has been signalled; false, if the timeout is reached without the thread having been signalled
      Throws:
      InterruptedException - if the thread is interrupted
    • set

      public void set()
      Signals the event, unblocking all waiting threads.
    • reset

      public void reset()
      Resets the event signal, such that any further calls to waitOne() will cause threads to block until the event is set() again.