diff options
Diffstat (limited to 'src/3rdParty/efsw/platform/posix/MutexImpl.cpp')
-rwxr-xr-x | src/3rdParty/efsw/platform/posix/MutexImpl.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/3rdParty/efsw/platform/posix/MutexImpl.cpp b/src/3rdParty/efsw/platform/posix/MutexImpl.cpp new file mode 100755 index 0000000..2233798 --- /dev/null +++ b/src/3rdParty/efsw/platform/posix/MutexImpl.cpp | |||
@@ -0,0 +1,28 @@ | |||
1 | #include <efsw/platform/posix/MutexImpl.hpp> | ||
2 | |||
3 | #if defined( EFSW_PLATFORM_POSIX ) | ||
4 | |||
5 | namespace efsw { namespace Platform { | ||
6 | |||
7 | MutexImpl::MutexImpl() { | ||
8 | pthread_mutexattr_t attributes; | ||
9 | pthread_mutexattr_init( &attributes ); | ||
10 | pthread_mutexattr_settype( &attributes, PTHREAD_MUTEX_RECURSIVE ); | ||
11 | pthread_mutex_init( &mMutex, &attributes ); | ||
12 | } | ||
13 | |||
14 | MutexImpl::~MutexImpl() { | ||
15 | pthread_mutex_destroy( &mMutex ); | ||
16 | } | ||
17 | |||
18 | void MutexImpl::lock() { | ||
19 | pthread_mutex_lock( &mMutex ); | ||
20 | } | ||
21 | |||
22 | void MutexImpl::unlock() { | ||
23 | pthread_mutex_unlock( &mMutex ); | ||
24 | } | ||
25 | |||
26 | }} // namespace efsw::Platform | ||
27 | |||
28 | #endif | ||