| 96 | } |
| 97 | |
| 98 | orbis::ErrorCode orbis::EventFlag::tryWait(Thread *thread, |
| 99 | std::uint8_t waitMode, |
| 100 | std::uint64_t bitPattern) { |
| 101 | rx::writer_lock lock(queueMtx); |
| 102 | |
| 103 | if (isDeleted) { |
| 104 | return ErrorCode::ACCES; |
| 105 | } |
| 106 | |
| 107 | auto waitingThread = |
| 108 | WaitingThread{.bitPattern = bitPattern, .waitMode = waitMode}; |
| 109 | |
| 110 | if (auto patValue = value.load(std::memory_order::relaxed); |
| 111 | waitingThread.test(patValue)) { |
| 112 | auto resultValue = waitingThread.applyClear(patValue); |
| 113 | value.store(resultValue, std::memory_order::relaxed); |
| 114 | thread->evfResultPattern = patValue; |
| 115 | return {}; |
| 116 | } |
| 117 | |
| 118 | return ErrorCode::BUSY; |
| 119 | } |
| 120 | |
| 121 | std::size_t orbis::EventFlag::notify(NotifyType type, std::uint64_t bits) { |
| 122 | rx::writer_lock lock(queueMtx); |
no test coverage detected