| 69 | } |
| 70 | |
| 71 | void __shared_mutex_base::unlock_shared() { |
| 72 | unique_lock<mutex> lk(__mut_); |
| 73 | unsigned num_readers = (__state_ & __n_readers_) - 1; |
| 74 | __state_ &= ~__n_readers_; |
| 75 | __state_ |= num_readers; |
| 76 | if (__state_ & __write_entered_) { |
| 77 | if (num_readers == 0) { |
| 78 | lk.unlock(); |
| 79 | __gate2_.notify_one(); |
| 80 | } |
| 81 | } else { |
| 82 | if (num_readers == __n_readers_ - 1) { |
| 83 | lk.unlock(); |
| 84 | __gate1_.notify_one(); |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | // Shared Timed Mutex |
| 90 | // These routines are here for ABI stability |
no test coverage detected