aboutsummaryrefslogtreecommitdiff
path: root/drivers/unix/mutex_posix.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2017-03-05 16:44:50 +0100
committerRémi Verschelde2017-03-05 16:44:50 +0100
commit5dbf1809c6e3e905b94b8764e99491e608122261 (patch)
tree5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /drivers/unix/mutex_posix.cpp
parent45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff)
downloadgodot-5dbf1809c6e3e905b94b8764e99491e608122261.tar.gz
godot-5dbf1809c6e3e905b94b8764e99491e608122261.tar.zst
godot-5dbf1809c6e3e905b94b8764e99491e608122261.zip
Diffstat (limited to 'drivers/unix/mutex_posix.cpp')
-rw-r--r--drivers/unix/mutex_posix.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/unix/mutex_posix.cpp b/drivers/unix/mutex_posix.cpp
index c9b5bdce7..9009da206 100644
--- a/drivers/unix/mutex_posix.cpp
+++ b/drivers/unix/mutex_posix.cpp
@@ -34,7 +34,6 @@
void MutexPosix::lock() {
pthread_mutex_lock(&mutex);
-
}
void MutexPosix::unlock() {
@@ -42,32 +41,30 @@ void MutexPosix::unlock() {
}
Error MutexPosix::try_lock() {
- return (pthread_mutex_trylock(&mutex)==0)?OK:ERR_BUSY;
+ return (pthread_mutex_trylock(&mutex) == 0) ? OK : ERR_BUSY;
}
Mutex *MutexPosix::create_func_posix(bool p_recursive) {
- return memnew( MutexPosix(p_recursive) );
+ return memnew(MutexPosix(p_recursive));
}
void MutexPosix::make_default() {
- create_func=create_func_posix;
+ create_func = create_func_posix;
}
MutexPosix::MutexPosix(bool p_recursive) {
-
+
pthread_mutexattr_init(&attr);
if (p_recursive)
- pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_RECURSIVE);
- pthread_mutex_init(&mutex,&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&mutex, &attr);
}
-
MutexPosix::~MutexPosix() {
pthread_mutex_destroy(&mutex);
}
-
#endif