feat update
Some checks failed
rpcrypto-build / build (Debug, hisiv510.toolchain.cmake) (push) Successful in 1m6s
rpcrypto-build / build (Debug, himix200.toolchain.cmake) (push) Successful in 1m8s
rpcrypto-build / build (Release, himix200.toolchain.cmake) (push) Successful in 1m8s
linux-x64-gcc / linux-gcc (push) Failing after 1m7s
rpcrypto-build / build (Release, hisiv510.toolchain.cmake) (push) Successful in 1m34s
linux-mips64-gcc / linux-gcc-mips64el (push) Failing after 1m37s
linux-hisiv500-gcc / linux-gcc-hisiv500 (push) Successful in 1m42s

This commit is contained in:
tqcq 2024-02-27 14:30:27 +08:00
parent 47b64af7a8
commit 6b2bb26713

View File

@ -11,7 +11,13 @@ namespace ulib {
namespace detail { namespace detail {
class MutexImpl { class MutexImpl {
public: public:
MutexImpl() { pthread_mutex_init(&mutex_, NULL); } MutexImpl()
{
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&mutex_, &attr);
}
~MutexImpl() { pthread_mutex_destroy(&mutex_); } ~MutexImpl() { pthread_mutex_destroy(&mutex_); }
@ -25,7 +31,7 @@ private:
friend class ConditionVariableImpl; friend class ConditionVariableImpl;
pthread_mutex_t mutex_; pthread_mutex_t mutex_;
}; };
} // namespace detail }// namespace detail
} // namespace ulib }// namespace ulib
#endif//ULIB_SRC_ULIB_CONCORRENCY_INTERNAL_MUTEX_IMPL_H_ #endif//ULIB_SRC_ULIB_CONCORRENCY_INTERNAL_MUTEX_IMPL_H_