| 25 | return false; |
| 26 | } |
| 27 | void CoroMutex::Unlock() |
| 28 | { |
| 29 | // guard against unlocking twice from same coro or unlocked when there are no waiters |
| 30 | if (counter_ == 0 || holdoff_) { |
| 31 | return; |
| 32 | } |
| 33 | |
| 34 | --counter_; |
| 35 | |
| 36 | if (waiters_.empty()) { |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | holdoff_ = true; |
| 41 | waiters_.front()->cancel(); |
| 42 | waiters_.pop_front(); |
| 43 | } |
| 44 | |
| 45 | |
| 46 | CoroLockGuard::CoroLockGuard(CoroLockGuard&& other) |