| 109 | } |
| 110 | } |
| 111 | bool tryBeginRead(const char* aReason) |
| 112 | { |
| 113 | if (lock.value() < 0) |
| 114 | return false; |
| 115 | if (lock.exchangeAdd(1) >= 0) |
| 116 | { |
| 117 | reason(aReason); |
| 118 | return true; |
| 119 | } |
| 120 | // We stepped on writer's toes. Fix our mistake |
| 121 | if (lock.exchangeAdd(-1) == 1) |
| 122 | unblockWaiting(); |
| 123 | return false; |
| 124 | } |
| 125 | bool tryBeginWrite(const char* aReason) |
| 126 | { |
| 127 | if (lock.value()) |
nothing calls this directly
no test coverage detected