YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
mutex.cpp
Go to the documentation of this file.
2
3namespace yaclib::detail::fiber {
4
5void Mutex::lock() {
6 while (_occupied) {
8 }
9 _occupied = true;
10}
11
13 if (_occupied) {
14 return false;
15 }
16 _occupied = true;
17 return true;
18}
19
21 _occupied = false;
23}
24
28
29} // namespace yaclib::detail::fiber
WaitStatus Wait(NoTimeoutTag)
Definition queue.cpp:5
native_handle_type native_handle()
Definition mutex.cpp:25
void unlock() noexcept
Definition mutex.cpp:20
bool try_lock() noexcept
Definition mutex.cpp:12
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25