| 1153 | } |
| 1154 | |
| 1155 | void FastPthreadMutex::unlock() { |
| 1156 | SUB_TLS_PTHREAD_LOCK_COUNT; |
| 1157 | MUTEX_RESET_OWNER_COMMON(_owner); |
| 1158 | auto whole = (butil::atomic<unsigned>*)&_futex; |
| 1159 | const unsigned prev = whole->exchange(0, butil::memory_order_release); |
| 1160 | // CAUTION: the mutex may be destroyed, check comments before butex_create |
| 1161 | if (prev != BTHREAD_MUTEX_LOCKED) { |
| 1162 | futex_wake_private(whole, 1); |
| 1163 | } |
| 1164 | } |
| 1165 | |
| 1166 | } // namespace internal |
| 1167 | #endif // BTHREAD_USE_FAST_PTHREAD_MUTEX |
no test coverage detected