7#include <condition_variable>
19 std::unique_lock autolock(
cv_lock);
21 cv.wait(autolock, [&] {
return counter == ticket; });
26 std::lock_guard autolock(
cv_lock);
36 std::lock_guard autolock(
cv_lock);
43 std::condition_variable
cv;
Definition ordered_mutex.h:13
uint_fast32_t counter
Definition ordered_mutex.h:45
void unlock()
Definition ordered_mutex.h:33
std::mutex cv_lock
Definition ordered_mutex.h:44
bool try_lock()
Definition ordered_mutex.h:24
ordered_mutex()
Definition ordered_mutex.h:15
void lock()
Definition ordered_mutex.h:17
uint_fast32_t next_ticket
Definition ordered_mutex.h:45
std::condition_variable cv
Definition ordered_mutex.h:43