forked from Alepha/Alepha
Non-blocking states and documentation for Interlock
.
This commit is contained in:
32
Thread.h
32
Thread.h
@ -62,6 +62,22 @@ namespace Alepha::Hydrogen ::detail:: Thread_m
|
||||
~Interlock();
|
||||
Interlock();
|
||||
|
||||
/*!
|
||||
* Wait on interlock condition.
|
||||
*
|
||||
* Blocks this thread until another thread also rendezvous
|
||||
* with this `Interlock`. If there already is another thread
|
||||
* waiting, then that thread will be reawakened after the
|
||||
* `synchronize` step.
|
||||
*
|
||||
* @param lock A lock on a mutex which governs exclusive
|
||||
* access to the shared state among these threads.
|
||||
*
|
||||
* @param synchronize The action to take which
|
||||
* resynchronizes the state among these threads.
|
||||
*
|
||||
* @note This operation is an `interruption_point`
|
||||
*/
|
||||
void
|
||||
wait( unique_lock< mutex > &lock, auto &&synchronize )
|
||||
{
|
||||
@ -69,6 +85,22 @@ namespace Alepha::Hydrogen ::detail:: Thread_m
|
||||
interlock( lock );
|
||||
}
|
||||
|
||||
/*!
|
||||
* Notify but don't Wait on interlock condition.
|
||||
*
|
||||
* Marks that a thread has reached another this rendezvous
|
||||
* with this `Interlock`. If there already is another thread
|
||||
* waiting, then that thread will be reawakened after the
|
||||
* `synchronize` step.
|
||||
*
|
||||
* @param lock A lock on a mutex which governs exclusive
|
||||
* access to the shared state among these threads.
|
||||
*
|
||||
* @param synchronize The action to take which
|
||||
* resynchronizes the state among these threads.
|
||||
*
|
||||
* @note This operation is not an `interruption_point`
|
||||
*/
|
||||
void
|
||||
checkpoint( unique_lock< mutex > &lock, auto &&synchronize )
|
||||
{
|
||||
|
Reference in New Issue
Block a user