13 #ifndef __PROCESS_MUTEX_HPP__ 14 #define __PROCESS_MUTEX_HPP__ 37 synchronized (data->lock) {
43 data->waiters.push(std::move(waiter));
57 synchronized (data->lock) {
58 if (!data->waiters.empty()) {
60 waiter = std::move(data->waiters.front());
75 Data() : locked(
false) {}
84 std::atomic_flag
lock = ATOMIC_FLAG_INIT;
90 std::queue<Promise<Nothing>> waiters;
93 std::shared_ptr<Data> data;
98 #endif // __PROCESS_MUTEX_HPP__
Definition: nothing.hpp:16
void unlock()
Definition: mutex.hpp:50
Definition: option.hpp:29
bool isSome() const
Definition: option.hpp:116
Mutex()
Definition: mutex.hpp:31
Future< Nothing > lock()
Definition: mutex.hpp:33
Definition: executor.hpp:48
Future< T > future() const
Definition: future.hpp:913