MCPcopy Create free account
hub / github.com/apache/brpc / unlock

Method unlock

src/bthread/mutex.cpp:1155–1164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1153}
1154
1155void 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

Callers 15

SetMethod · 0.45
GetMethod · 0.45
popMethod · 0.45
pushMethod · 0.45
futex_wait_privateFunction · 0.45
futex_wake_privateFunction · 0.45
ContentionProfilerStopFunction · 0.45
id_statusFunction · 0.45
bthread_id_cancelFunction · 0.45

Calls 3

futex_wake_privateFunction · 0.70
exchangeMethod · 0.45

Tested by

no test coverage detected