diff options
| author | Rémi Verschelde | 2017-03-19 00:36:26 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-19 00:36:26 +0100 |
| commit | f8db8a3faa30b71dca33ced38be16d3f93f43e8a (patch) | |
| tree | 3b798318132cca7eccfbca5818ab55656a2896d7 /drivers/unix/mutex_posix.cpp | |
| parent | 1d418afe863c9e553b69174ce63aef203c46d2f0 (diff) | |
| download | godot-f8db8a3faa30b71dca33ced38be16d3f93f43e8a.tar.gz godot-f8db8a3faa30b71dca33ced38be16d3f93f43e8a.tar.zst godot-f8db8a3faa30b71dca33ced38be16d3f93f43e8a.zip | |
Diffstat (limited to 'drivers/unix/mutex_posix.cpp')
| -rw-r--r-- | drivers/unix/mutex_posix.cpp | 15 |
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 |
