diff options
| author | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
| commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
| tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /platform/osx/sem_osx.cpp | |
| parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
| download | godot-5dbf1809c6e3e905b94b8764e99491e608122261.tar.gz godot-5dbf1809c6e3e905b94b8764e99491e608122261.tar.zst godot-5dbf1809c6e3e905b94b8764e99491e608122261.zip | |
Diffstat (limited to 'platform/osx/sem_osx.cpp')
| -rw-r--r-- | platform/osx/sem_osx.cpp | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/platform/osx/sem_osx.cpp b/platform/osx/sem_osx.cpp index ca710d8b1..069e3a515 100644 --- a/platform/osx/sem_osx.cpp +++ b/platform/osx/sem_osx.cpp @@ -28,11 +28,10 @@ /*************************************************************************/ #include "sem_osx.h" -#include <unistd.h> #include <fcntl.h> +#include <unistd.h> -void cgsem_init(cgsem_t *cgsem) -{ +void cgsem_init(cgsem_t *cgsem) { int flags, fd, i; pipe(cgsem->pipefd); @@ -47,31 +46,26 @@ void cgsem_init(cgsem_t *cgsem) } } -void cgsem_post(cgsem_t *cgsem) -{ +void cgsem_post(cgsem_t *cgsem) { const char buf = 1; write(cgsem->pipefd[1], &buf, 1); } -void cgsem_wait(cgsem_t *cgsem) -{ +void cgsem_wait(cgsem_t *cgsem) { char buf; read(cgsem->pipefd[0], &buf, 1); } -void cgsem_destroy(cgsem_t *cgsem) -{ +void cgsem_destroy(cgsem_t *cgsem) { close(cgsem->pipefd[1]); close(cgsem->pipefd[0]); } - #include "os/memory.h" #include <errno.h> - Error SemaphoreOSX::wait() { cgsem_wait(&sem); @@ -89,15 +83,14 @@ int SemaphoreOSX::get() const { return 0; } - Semaphore *SemaphoreOSX::create_semaphore_osx() { - return memnew( SemaphoreOSX ); + return memnew(SemaphoreOSX); } void SemaphoreOSX::make_default() { - create_func=create_semaphore_osx; + create_func = create_semaphore_osx; } SemaphoreOSX::SemaphoreOSX() { @@ -105,11 +98,7 @@ SemaphoreOSX::SemaphoreOSX() { cgsem_init(&sem); } - SemaphoreOSX::~SemaphoreOSX() { cgsem_destroy(&sem); } - - - |
