From 3c2901a9765fff6aa3efb29cb2762e75d185b006 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sat, 27 Jul 2019 18:32:18 -0400 Subject: [PATCH] libroot: Expose the internal mutex_lock for private consumption. --- headers/private/libroot/pthread_private.h | 1 + src/system/libroot/posix/pthread/pthread_mutex.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/headers/private/libroot/pthread_private.h b/headers/private/libroot/pthread_private.h index 850ff3c730..4033102d1c 100644 --- a/headers/private/libroot/pthread_private.h +++ b/headers/private/libroot/pthread_private.h @@ -92,6 +92,7 @@ status_t __pthread_init_creation_attributes( void* argument2, const char* name, struct thread_creation_attributes* attributes); void __pthread_set_default_priority(int32 priority); +status_t __pthread_mutex_lock(pthread_mutex_t* mutex, bigtime_t timeout); #ifdef __cplusplus } diff --git a/src/system/libroot/posix/pthread/pthread_mutex.cpp b/src/system/libroot/posix/pthread/pthread_mutex.cpp index db276e2f1e..27cc11bbff 100644 --- a/src/system/libroot/posix/pthread/pthread_mutex.cpp +++ b/src/system/libroot/posix/pthread/pthread_mutex.cpp @@ -49,8 +49,8 @@ pthread_mutex_destroy(pthread_mutex_t* mutex) } -static status_t -mutex_lock(pthread_mutex_t* mutex, bigtime_t timeout) +status_t +__pthread_mutex_lock(pthread_mutex_t* mutex, bigtime_t timeout) { thread_id thisThread = find_thread(NULL); @@ -104,14 +104,14 @@ mutex_lock(pthread_mutex_t* mutex, bigtime_t timeout) int pthread_mutex_lock(pthread_mutex_t* mutex) { - return mutex_lock(mutex, B_INFINITE_TIMEOUT); + return __pthread_mutex_lock(mutex, B_INFINITE_TIMEOUT); } int pthread_mutex_trylock(pthread_mutex_t* mutex) { - return mutex_lock(mutex, -1); + return __pthread_mutex_lock(mutex, -1); } @@ -126,7 +126,7 @@ pthread_mutex_timedlock(pthread_mutex_t* mutex, const struct timespec* tv) else invalidTime = true; - status_t status = mutex_lock(mutex, timeout); + status_t status = __pthread_mutex_lock(mutex, timeout); if (status != B_OK && invalidTime) { // The timespec was not valid and the mutex could not be locked // immediately.