| 137 | return false; |
| 138 | } |
| 139 | void beginRead(const char* aReason) |
| 140 | { |
| 141 | if (!tryBeginRead(aReason)) |
| 142 | { |
| 143 | { // scope block |
| 144 | MutexLockGuard guard(blockedReadersLock, "RWLock::beginRead"); |
| 145 | ++blockedReaders; |
| 146 | } |
| 147 | while (!tryBeginRead(aReason)) |
| 148 | { |
| 149 | if (WaitForSingleObject(readers_semaphore, INFINITE) != WAIT_OBJECT_0) |
| 150 | system_call_failed::raise("WaitForSingleObject"); |
| 151 | } |
| 152 | { // scope block |
| 153 | MutexLockGuard guard(blockedReadersLock, "RWLock::beginRead"); |
| 154 | --blockedReaders; |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | void beginWrite(const char* aReason) |
| 159 | { |
| 160 | if (!tryBeginWrite(aReason)) |
no test coverage detected