fix use RecursiveMutex

This commit is contained in:
tqcq 2024-04-02 09:34:33 +08:00
parent 56026fcfca
commit b8ceaa7fcd
2 changed files with 13 additions and 4 deletions

View File

@ -4,13 +4,20 @@ namespace sigslot {
#ifdef _SIGSLOT_HAS_POSIX_THREADS #ifdef _SIGSLOT_HAS_POSIX_THREADS
sled::Mutex * sled::RecursiveMutex *
multi_threaded_global::get_mutex() multi_threaded_global::get_mutex()
{ {
static sled::Mutex g_mutex; static sled::RecursiveMutex g_mutex;
return &g_mutex; return &g_mutex;
} }
// sled::Mutex *
// multi_threaded_global::get_mutex()
// {
// static sled::Mutex g_mutex;
// return &g_mutex;
// }
// pthread_mutex_t * // pthread_mutex_t *
// multi_threaded_global::get_mutex() // multi_threaded_global::get_mutex()
// { // {

View File

@ -196,7 +196,8 @@ public:
} }
private: private:
static sled::Mutex *get_mutex(); static sled::RecursiveMutex *get_mutex();
// static sled::Mutex *get_mutex();
// static pthread_mutex_t *get_mutex(); // static pthread_mutex_t *get_mutex();
}; };
@ -224,7 +225,8 @@ public:
} }
private: private:
sled::Mutex mutex_; sled::RecursiveMutex mutex_;
// sled::Mutex mutex_;
// pthread_mutex_t m_mutex; // pthread_mutex_t m_mutex;
}; };
#endif// _SIGSLOT_HAS_POSIX_THREADS #endif// _SIGSLOT_HAS_POSIX_THREADS