From 153ac6df9a7731fcbe5ba1389e8380f64d58f921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Fri, 17 Dec 2021 18:32:11 +0100 Subject: [PATCH] Use recursive mutexes in the C++ thread implementation --- src/cpp11_thread.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cpp11_thread.cpp b/src/cpp11_thread.cpp index 96eb4a2e1..02bd87143 100644 --- a/src/cpp11_thread.cpp +++ b/src/cpp11_thread.cpp @@ -41,7 +41,7 @@ thread_wait(thread_t *arg, int timeout) mutex_t * thread_create_mutex(void) { - auto mutex = new std::mutex; + auto mutex = new std::recursive_mutex; return mutex; } @@ -50,7 +50,7 @@ thread_wait_mutex(mutex_t *_mutex) { if (_mutex == nullptr) return(0); - auto mutex = reinterpret_cast(_mutex); + auto mutex = reinterpret_cast(_mutex); mutex->lock(); return 1; } @@ -61,7 +61,7 @@ thread_release_mutex(mutex_t *_mutex) { if (_mutex == nullptr) return(0); - auto mutex = reinterpret_cast(_mutex); + auto mutex = reinterpret_cast(_mutex); mutex->unlock(); return 1; } @@ -70,7 +70,7 @@ thread_release_mutex(mutex_t *_mutex) void thread_close_mutex(mutex_t *_mutex) { - auto mutex = reinterpret_cast(_mutex); + auto mutex = reinterpret_cast(_mutex); delete mutex; }