From b8ceaa7fcd5c92f01bf24eecd89595e5e5155b08 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Tue, 2 Apr 2024 09:34:33 +0800 Subject: [PATCH] fix use RecursiveMutex --- src/sled/sigslot.cc | 11 +++++++++-- src/sled/sigslot.h | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/sled/sigslot.cc b/src/sled/sigslot.cc index 0438f60..183b599 100644 --- a/src/sled/sigslot.cc +++ b/src/sled/sigslot.cc @@ -4,13 +4,20 @@ namespace sigslot { #ifdef _SIGSLOT_HAS_POSIX_THREADS -sled::Mutex * +sled::RecursiveMutex * multi_threaded_global::get_mutex() { - static sled::Mutex g_mutex; + static sled::RecursiveMutex g_mutex; return &g_mutex; } +// sled::Mutex * +// multi_threaded_global::get_mutex() +// { +// static sled::Mutex g_mutex; +// return &g_mutex; +// } + // pthread_mutex_t * // multi_threaded_global::get_mutex() // { diff --git a/src/sled/sigslot.h b/src/sled/sigslot.h index 424d61e..0dd438b 100644 --- a/src/sled/sigslot.h +++ b/src/sled/sigslot.h @@ -196,7 +196,8 @@ public: } private: - static sled::Mutex *get_mutex(); + static sled::RecursiveMutex *get_mutex(); + // static sled::Mutex *get_mutex(); // static pthread_mutex_t *get_mutex(); }; @@ -224,7 +225,8 @@ public: } private: - sled::Mutex mutex_; + sled::RecursiveMutex mutex_; + // sled::Mutex mutex_; // pthread_mutex_t m_mutex; }; #endif// _SIGSLOT_HAS_POSIX_THREADS