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(
75
75
libc.src.__support.OSUtil.osutil
76
76
libc.src.__support.threads.linux.futex_word_type
77
77
libc.src.__support.threads.mutex
78
+ libc.src.__support.CPP.mutex
78
79
)
Original file line number Diff line number Diff line change 7
7
// ===----------------------------------------------------------------------===//
8
8
9
9
#include " src/__support/threads/CndVar.h"
10
+ #include " src/__support/CPP/mutex.h"
10
11
#include " src/__support/OSUtil/syscall.h" // syscall_impl
11
12
#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
13
14
14
15
#include < sys/syscall.h> // For syscall numbers.
15
16
@@ -27,7 +28,7 @@ int CndVar::wait(Mutex *m) {
27
28
28
29
CndWaiter waiter;
29
30
{
30
- MutexLock ml (& qmtx);
31
+ cpp::lock_guard ml (qmtx);
31
32
CndWaiter *old_back = nullptr ;
32
33
if (waitq_front == nullptr ) {
33
34
waitq_front = waitq_back = &waiter;
@@ -83,7 +84,7 @@ void CndVar::notify_one() {
83
84
}
84
85
85
86
void CndVar::broadcast () {
86
- MutexLock ml (& qmtx);
87
+ cpp::lock_guard ml (qmtx);
87
88
uint32_t dummy_futex_word;
88
89
CndWaiter *waiter = waitq_front;
89
90
waitq_front = waitq_back = nullptr ;
Original file line number Diff line number Diff line change 43
43
#include " src/__support/threads/gpu/mutex.h"
44
44
#endif // __linux__
45
45
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
-
60
46
#endif // LLVM_LIBC_SRC___SUPPORT_THREADS_MUTEX_H
You can’t perform that action at this time.
0 commit comments