File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 66 * SPDX-License-Identifier: BSD-2-Clause
77 */
88
9+ #include < AK/Assertions.h>
910#include < AK/Concepts.h>
1011#include < AK/Diagnostics.h>
1112#include < AK/Error.h>
@@ -67,8 +68,11 @@ MutexBase<RecursivePolicy, InterprocessPolicy>::MutexBase()
6768 pthread_mutex_t * mutex_ptr = new (m_storage) pthread_mutex_t ;
6869 pthread_mutexattr_t attr;
6970 pthread_mutexattr_init (&attr);
70- if constexpr (IsSame<RecursivePolicy, PolicyRecursive>)
71+ if constexpr (IsSame<RecursivePolicy, PolicyRecursive>) {
7172 pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
73+ } else {
74+ pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ERRORCHECK);
75+ }
7276 if constexpr (IsSame<InterprocessPolicy, PolicyInterprocess>)
7377 pthread_mutexattr_setpshared (&attr, PTHREAD_PROCESS_SHARED);
7478 int result = pthread_mutex_init (mutex_ptr, &attr);
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ class SYNC_API MutexBase {
5050 ~MutexBase ();
5151
5252 bool try_lock ();
53+
5354 void lock ();
5455 void unlock ();
5556
You can’t perform that action at this time.
0 commit comments