diff --git a/core/AmAppTimer.cpp b/core/AmAppTimer.cpp index 37fd9789..0abb7b04 100644 --- a/core/AmAppTimer.cpp +++ b/core/AmAppTimer.cpp @@ -69,7 +69,7 @@ public: }; _AmAppTimer::_AmAppTimer() - : direct_timers_mut(true) + : direct_timers_mut() { } diff --git a/core/AmAppTimer.h b/core/AmAppTimer.h index 9b99a88d..78c6d66c 100644 --- a/core/AmAppTimer.h +++ b/core/AmAppTimer.h @@ -57,7 +57,7 @@ class _AmAppTimer AmMutex user_timers_mut; TimerQueues user_timers; - AmMutex direct_timers_mut; + std::recursive_mutex direct_timers_mut; DirectTimers direct_timers; /** creates timer object and inserts it into our container */ diff --git a/core/AmThread.cpp b/core/AmThread.cpp index faf38fe5..fffb981a 100644 --- a/core/AmThread.cpp +++ b/core/AmThread.cpp @@ -33,18 +33,9 @@ #include using std::string; -AmMutex::AmMutex(bool recursive) +AmMutex::AmMutex() { - if(recursive) { - pthread_mutexattr_t attr; - - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&m, &attr); - } - else { - pthread_mutex_init(&m,NULL); - } + pthread_mutex_init(&m,NULL); } AmMutex::~AmMutex() diff --git a/core/AmThread.h b/core/AmThread.h index 35190144..75448636 100644 --- a/core/AmThread.h +++ b/core/AmThread.h @@ -46,7 +46,7 @@ class AmMutex pthread_mutex_t m; public: - AmMutex(bool recursive = false); + AmMutex(); ~AmMutex(); void lock(); void unlock(); diff --git a/core/sip/async_file.cpp b/core/sip/async_file.cpp index b4252270..9ce89e13 100644 --- a/core/sip/async_file.cpp +++ b/core/sip/async_file.cpp @@ -20,7 +20,7 @@ Possible issue: */ async_file::async_file(unsigned int buf_len) - : AmMutex(true), fifo_buffer(buf_len), + : fifo_buffer(buf_len), evbase(NULL),closed(false),error(false),write_thresh(MIN_WRITE_SIZE) { if (buf_len <= MIN_WRITE_SIZE) { @@ -41,7 +41,7 @@ async_file::~async_file() int async_file::write(const void* buf, unsigned int len) { - lock_guard _l(*this); + lock_guard _l(*this); if(closed) return Closed; if(error) return Error; @@ -58,7 +58,7 @@ int async_file::write(const void* buf, unsigned int len) int async_file::writev(const struct iovec *iov, int iovcnt) { - lock_guard _l(*this); + lock_guard _l(*this); if(closed) return Closed; if(error) return Error; @@ -75,7 +75,7 @@ int async_file::writev(const struct iovec *iov, int iovcnt) void async_file::close() { - lock_guard _l(*this); + lock_guard _l(*this); closed = true; event_active(ev_write, 0, 0); } @@ -120,6 +120,6 @@ void async_file::write_cycle() unsigned int async_file::get_buffered_bytes() { - lock_guard _l(*this); + lock_guard _l(*this); return fifo_buffer::get_buffered_bytes(); } diff --git a/core/sip/async_file.h b/core/sip/async_file.h index 86312fb5..c2ba35cf 100644 --- a/core/sip/async_file.h +++ b/core/sip/async_file.h @@ -6,7 +6,7 @@ class async_file : protected fifo_buffer, - public AmMutex + public std::recursive_mutex { struct event_base* evbase; struct event* ev_write;