blob: 2233798284c15c230536de070fffe10ea779d84e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include <efsw/platform/posix/MutexImpl.hpp>
#if defined( EFSW_PLATFORM_POSIX )
namespace efsw { namespace Platform {
MutexImpl::MutexImpl() {
pthread_mutexattr_t attributes;
pthread_mutexattr_init( &attributes );
pthread_mutexattr_settype( &attributes, PTHREAD_MUTEX_RECURSIVE );
pthread_mutex_init( &mMutex, &attributes );
}
MutexImpl::~MutexImpl() {
pthread_mutex_destroy( &mMutex );
}
void MutexImpl::lock() {
pthread_mutex_lock( &mMutex );
}
void MutexImpl::unlock() {
pthread_mutex_unlock( &mMutex );
}
}} // namespace efsw::Platform
#endif
|