File tree Expand file tree Collapse file tree 3 files changed +5
-17
lines changed
libc/src/__support/threads Expand file tree Collapse file tree 3 files changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -75,4 +75,5 @@ add_object_library(
7575 libc.src.__support.OSUtil.osutil
7676 libc.src.__support.threads.linux.futex_word_type
7777 libc.src.__support.threads.mutex
78+ libc.src.__support.CPP.mutex
7879)
Original file line number Diff line number Diff line change 77// ===----------------------------------------------------------------------===//
88
99#include " src/__support/threads/CndVar.h"
10+ #include " src/__support/CPP/mutex.h"
1011#include " src/__support/OSUtil/syscall.h" // syscall_impl
1112#include " src/__support/threads/linux/futex_word.h" // FutexWordType
12- #include " src/__support/threads/mutex.h" // Mutex, MutexLock
13+ #include " src/__support/threads/mutex.h" // Mutex
1314
1415#include < sys/syscall.h> // For syscall numbers.
1516
@@ -27,7 +28,7 @@ int CndVar::wait(Mutex *m) {
2728
2829 CndWaiter waiter;
2930 {
30- MutexLock ml (& qmtx);
31+ cpp::lock_guard ml (qmtx);
3132 CndWaiter *old_back = nullptr ;
3233 if (waitq_front == nullptr ) {
3334 waitq_front = waitq_back = &waiter;
@@ -83,7 +84,7 @@ void CndVar::notify_one() {
8384}
8485
8586void CndVar::broadcast () {
86- MutexLock ml (& qmtx);
87+ cpp::lock_guard ml (qmtx);
8788 uint32_t dummy_futex_word;
8889 CndWaiter *waiter = waitq_front;
8990 waitq_front = waitq_back = nullptr ;
Original file line number Diff line number Diff line change 4343#include " src/__support/threads/gpu/mutex.h"
4444#endif // __linux__
4545
46- namespace LIBC_NAMESPACE {
47-
48- // An RAII class for easy locking and unlocking of mutexes.
49- class MutexLock {
50- Mutex *mutex;
51-
52- public:
53- explicit MutexLock (Mutex *m) : mutex(m) { mutex->lock (); }
54-
55- ~MutexLock () { mutex->unlock (); }
56- };
57-
58- } // namespace LIBC_NAMESPACE
59-
6046#endif // LLVM_LIBC_SRC___SUPPORT_THREADS_MUTEX_H
You can’t perform that action at this time.
0 commit comments