1
0
forked from Alepha/Alepha

Non-blocking states and documentation for Interlock.

This commit is contained in:
2023-12-12 23:56:17 -05:00
parent 94596d0d7d
commit c04fc7be3c
3 changed files with 61 additions and 5 deletions

View File

@ -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 )
{