aboutsummaryrefslogtreecommitdiff
path: root/src/3rdParty/efsw/platform/posix/MutexImpl.cpp
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-11-15 17:23:46 +0800
committerLi Jin <dragon-fly@qq.com>2022-11-15 17:52:09 +0800
commit94f8330613877b3582d32bd11abd83a97b4399ad (patch)
tree5359de314be1ebde17f8d1e48632a97d18f9e50f /src/3rdParty/efsw/platform/posix/MutexImpl.cpp
parent60f8f00a022ac08701792b2897b72d8c99b50f52 (diff)
downloadyuescript-94f8330613877b3582d32bd11abd83a97b4399ad.tar.gz
yuescript-94f8330613877b3582d32bd11abd83a97b4399ad.tar.bz2
yuescript-94f8330613877b3582d32bd11abd83a97b4399ad.zip
adding -w option to Yuescript tool.
Diffstat (limited to 'src/3rdParty/efsw/platform/posix/MutexImpl.cpp')
-rwxr-xr-xsrc/3rdParty/efsw/platform/posix/MutexImpl.cpp28
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
5namespace efsw { namespace Platform {
6
7MutexImpl::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
14MutexImpl::~MutexImpl() {
15 pthread_mutex_destroy( &mMutex );
16}
17
18void MutexImpl::lock() {
19 pthread_mutex_lock( &mMutex );
20}
21
22void MutexImpl::unlock() {
23 pthread_mutex_unlock( &mMutex );
24}
25
26}} // namespace efsw::Platform
27
28#endif