| 48 | } |
| 49 | |
| 50 | void Mutex::lock() |
| 51 | { |
| 52 | uint32_t* futex = (uint32_t*)m_internal; |
| 53 | |
| 54 | if (State::Unlocked == atomicCompareAndSwap<uint32_t>(futex, State::Unlocked, State::Locked) ) |
| 55 | { |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | while (State::Unlocked != atomicCompareAndSwap<uint32_t>(futex, State::Locked, State::Contested) ) |
| 60 | { |
| 61 | crt0::futexWait(futex, State::Contested); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | void Mutex::unlock() |
| 66 | { |
no test coverage detected