Fix a bunch of RecursiveMutex code using plain mutex types.

This commit is contained in:
Mike Ash
2025-03-27 14:31:22 -04:00
parent 21aeead848
commit bb8317ae19
3 changed files with 12 additions and 12 deletions

View File

@@ -138,7 +138,7 @@ inline void lazy_mutex_unsafe_unlock(lazy_mutex_handle &handle) {
using recursive_mutex_handle = ::pthread_mutex_t;
inline void recursive_mutex_init(mutex_handle &handle, bool checked = false) {
inline void recursive_mutex_init(recursive_mutex_handle &handle, bool checked = false) {
::pthread_mutexattr_t attr;
SWIFT_LINUXTHREADS_CHECK(::pthread_mutexattr_init(&attr));
SWIFT_LINUXTHREADS_CHECK(
@@ -146,14 +146,14 @@ inline void recursive_mutex_init(mutex_handle &handle, bool checked = false) {
SWIFT_LINUXTHREADS_CHECK(::pthread_mutex_init(&handle, &attr));
SWIFT_LINUXTHREADS_CHECK(::pthread_mutexattr_destroy(&attr));
}
inline void recursive_mutex_destroy(mutex_handle &handle) {
inline void recursive_mutex_destroy(recursive_mutex_handle &handle) {
SWIFT_LINUXTHREADS_CHECK(::pthread_mutex_destroy(&handle));
}
inline void recursive_mutex_lock(mutex_handle &handle) {
inline void recursive_mutex_lock(recursive_mutex_handle &handle) {
SWIFT_LINUXTHREADS_CHECK(::pthread_mutex_lock(&handle));
}
inline void recursive_mutex_unlock(mutex_handle &handle) {
inline void recursive_mutex_unlock(recursive_mutex_handle &handle) {
SWIFT_LINUXTHREADS_CHECK(::pthread_mutex_unlock(&handle));
}

View File

@@ -134,7 +134,7 @@ inline void lazy_mutex_unsafe_unlock(lazy_mutex_handle &handle) {
using recursive_mutex_handle = ::pthread_mutex_t;
inline void recursive_mutex_init(mutex_handle &handle, bool checked = false) {
inline void recursive_mutex_init(recursive_mutex_handle &handle, bool checked = false) {
::pthread_mutexattr_t attr;
SWIFT_PTHREADS_CHECK(::pthread_mutexattr_init(&attr));
SWIFT_PTHREADS_CHECK(
@@ -142,14 +142,14 @@ inline void recursive_mutex_init(mutex_handle &handle, bool checked = false) {
SWIFT_PTHREADS_CHECK(::pthread_mutex_init(&handle, &attr));
SWIFT_PTHREADS_CHECK(::pthread_mutexattr_destroy(&attr));
}
inline void recursive_mutex_destroy(mutex_handle &handle) {
inline void recursive_mutex_destroy(recursive_mutex_handle &handle) {
SWIFT_PTHREADS_CHECK(::pthread_mutex_destroy(&handle));
}
inline void recursive_mutex_lock(mutex_handle &handle) {
inline void recursive_mutex_lock(recursive_mutex_handle &handle) {
SWIFT_PTHREADS_CHECK(::pthread_mutex_lock(&handle));
}
inline void recursive_mutex_unlock(mutex_handle &handle) {
inline void recursive_mutex_unlock(recursive_mutex_handle &handle) {
SWIFT_PTHREADS_CHECK(::pthread_mutex_unlock(&handle));
}

View File

@@ -244,10 +244,10 @@ using SmallMutex =
/// A recursive variant of Mutex.
class RecursiveMutex {
RecursiveMutex(const Mutex &) = delete;
RecursiveMutex &operator=(const Mutex &) = delete;
RecursiveMutex(Mutex &&) = delete;
RecursiveMutex &operator=(Mutex &&) = delete;
RecursiveMutex(const RecursiveMutex &) = delete;
RecursiveMutex &operator=(const RecursiveMutex &) = delete;
RecursiveMutex(RecursiveMutex &&) = delete;
RecursiveMutex &operator=(RecursiveMutex &&) = delete;
public:
/// Constructs a non-recursive mutex.