Condition Lock

The type uCondLock defines a internal synchronization-lock:

Note Name change

wait acquire and signal release.

  • empty() returns false if there are tasks blocked on the queue and true otherwise
  • wait() and signal() are used to block a thread on and unblock a thread from the queue of a condition, respectively.
  • wait atomically blocks the calling task and releases the argument owner-lock; AND, wait() re-acquire its argument owner-lock before returning.
  • signal() checks if there is a waiting task, if so, unblocks a waiting task from the queue of the condition lock; waiting tasks are released in FIFO order.
    • can be safely called without acquiring any owner lock associated with tasks waiting on the condition
  • broadcast() same as signal() except all waiting tasks are unblocked.

Need to understand this ^