xtd 0.2.0
Loading...
Searching...
No Matches

◆ pulse_all()

template<typename object_t >
static void xtd::threading::monitor::pulse_all ( const object_t &  obj)
inlinestatic

Notifies all waiting threads of a change in the object's state.

Parameters
objThe object a thread is waiting for.
Exceptions
xtd::threading::synchronization_lock_exceptionThe calling thread does not own the lock for the specified object.
Remarks
The thread that currently owns the lock on the specified object invokes this method to signal all threads waiting to acquire the lock on the object. After the signal is sent, the waiting threads are moved to the ready queue. When the thread that invoked xtd::threading::monitor::xtd::threading::monitor::pulse_all releases the lock, the next thread in the ready queue acquires the lock.
Note that a synchronized object holds several references, including a reference to the thread that currently holds the lock, a reference to the ready queue, which contains the threads that are ready to obtain the lock, and a reference to the waiting queue, which contains the threads that are waiting for notification of a change in the object's state.
The xtd::threading::monitor::pulse, xtd::threading::monitor::xtd::threading::monitor::pulse_all, and Wait methods must be invoked from within a synchronized block of code.
The remarks for the xtd::threading::monitor::pulse method explain what happens if xtd::threading::monitor::pulse is called when no threads are waiting.
To signal a single thread, use the xtd::threading::monitor::pulse method.