mirror of https://gitlab.com/cppit/jucipp
Compare commits
No commits in common. '1f9e947a12b4cfd64b4529d8bcd331a1e2223347' and 'e4f7155f3551db8991b943274976fda6b355bba3' have entirely different histories.
1f9e947a12
...
e4f7155f35
13 changed files with 48 additions and 104 deletions
@ -1,39 +0,0 @@
|
||||
#include "mutex.hpp" |
||||
|
||||
#if defined(__clang__) && (!defined(SWIG)) |
||||
#pragma GCC diagnostic ignored "-Wthread-safety" |
||||
#endif |
||||
|
||||
void Mutex::lock() { |
||||
mutex.lock(); |
||||
} |
||||
|
||||
bool Mutex::try_lock() { |
||||
return mutex.try_lock(); |
||||
} |
||||
|
||||
void Mutex::unlock() { |
||||
mutex.unlock(); |
||||
} |
||||
|
||||
const Mutex &Mutex::operator!() const { return *this; } |
||||
|
||||
LockGuard::LockGuard(Mutex &mutex_) : mutex(mutex_) { |
||||
mutex.lock(); |
||||
locked = true; |
||||
} |
||||
|
||||
void LockGuard::lock() { |
||||
mutex.lock(); |
||||
locked = true; |
||||
} |
||||
|
||||
void LockGuard::unlock() { |
||||
mutex.unlock(); |
||||
locked = false; |
||||
} |
||||
|
||||
LockGuard::~LockGuard() { |
||||
if(locked) |
||||
mutex.unlock(); |
||||
} |
||||
Loading…
Reference in new issue