|
Condy v1.6.0
C++ Asynchronous System Call Layer for Linux
|
User-space "futex" implementation for efficient synchronization between coroutines. More...
#include <futex.hpp>
Public Member Functions | |
| Futex (std::atomic< T > &futex) | |
| Construct a new Futex object. | |
| WaitSender | wait (T old) noexcept |
| Wait if the futex value equals to the specified old value. The awaiting coroutine will be suspended until a notify is received. If the value of the futex is not equal to the old value, the awaiting coroutine will not be suspended. | |
| void | notify_one () noexcept |
| Notify one awaiting coroutine, if any. | |
| void | notify_all () noexcept |
| Notify all awaiting coroutines. | |
User-space "futex" implementation for efficient synchronization between coroutines.
This class provides a user-space futex implementation that allows coroutines to wait on a futex value and be efficiently notified when the value changes. This class is different from condy::async_futex_wait(), the latter one can be used together with thread-based synchronous wait.
| T | Type of the futex value. |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Wait if the futex value equals to the specified old value. The awaiting coroutine will be suspended until a notify is received. If the value of the futex is not equal to the old value, the awaiting coroutine will not be suspended.
| old | The old value to compare with the futex value. |