Creates a new condition variable. Conditions variables can be used to block one or more threads at the same time, until another thread modifies a shared variable (the condition) and signals the condition variable.

Constructor

@:has_untyped@:keepnew()

Create a new condition variable. A thread that waits on a newly created condition variable will block.

Methods

@:has_untyped@:keepacquire():Void

Acquires the internal mutex.

@:has_untyped@:keepbroadcast():Void

Unblocks all of the threads that are blocked on the condition variable at the time of the call. If no threads are blocked on the condition variable at the time of the call, the function does nothing.

@:has_untyped@:keeprelease():Void

Releases the internal mutex.

@:has_untyped@:keepsignal():Void

Unblocks one of the threads that are blocked on the condition variable at the time of the call. If no threads are blocked on the condition variable at the time of the call, the function does nothing.

@:has_untyped@:keeptryAcquire():Bool

Tries to acquire the internal mutex.

See also:

@:has_untyped@:keepwait():Void

Atomically releases the mutex and blocks until the condition variable pointed is signaled by a call to signal or to broadcast. When the calling thread becomes unblocked it acquires the internal mutex. The internal mutex should be locked before this function is called.