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

Function pthread_mutex_lock_internal

src/bthread/mutex.cpp:797–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

795
796#if HAS_PTHREAD_MUTEX_TIMEDLOCK
797BUTIL_FORCE_INLINE int pthread_mutex_lock_internal(pthread_mutex_t* mutex,
798 const struct timespec* abstime) {
799 int rc = 0;
800 if (NULL == abstime) {
801 FIND_SYS_PTHREAD_MUTEX_OWNER_MAP_ENTRY(mutex);
802 SYS_PTHREAD_MUTEX_CHECK_OWNER;
803 rc = sys_pthread_mutex_lock(mutex);
804 if (0 == rc) {
805 SYS_PTHREAD_MUTEX_SET_OWNER;
806 }
807 } else {
808 rc = sys_pthread_mutex_timedlock(mutex, abstime);
809 if (0 == rc) {
810 FIND_SYS_PTHREAD_MUTEX_OWNER_MAP_ENTRY(mutex);
811 SYS_PTHREAD_MUTEX_SET_OWNER;
812 }
813 }
814 if (0 == rc) {
815 ADD_TLS_PTHREAD_LOCK_COUNT;
816 }
817 return rc;
818}
819#else
820BUTIL_FORCE_INLINE int pthread_mutex_lock_internal(pthread_mutex_t* mutex,
821 const struct timespec*/* Not supported */) {

Callers 1

pthread_mutex_lock_implFunction · 0.85

Calls 2

lockMethod · 0.45
timed_lockMethod · 0.45

Tested by

no test coverage detected