diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/threads.cpp | 6 | ||||
-rw-r--r-- | common/threads.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/common/threads.cpp b/common/threads.cpp index eaf2cbbc..69989ae4 100644 --- a/common/threads.cpp +++ b/common/threads.cpp @@ -79,7 +79,7 @@ void semaphore::post() void semaphore::wait() noexcept { WaitForSingleObject(mSem, INFINITE); } -int semaphore::trywait() noexcept +bool semaphore::try_wait() noexcept { return WaitForSingleObject(mSem, 0) == WAIT_OBJECT_0; } } // namespace al @@ -129,7 +129,7 @@ void semaphore::post() void semaphore::wait() noexcept { dispatch_semaphore_wait(mSem, DISPATCH_TIME_FOREVER); } -int semaphore::trywait() noexcept +bool semaphore::try_wait() noexcept { return dispatch_semaphore_wait(mSem, DISPATCH_TIME_NOW) == 0; } #else /* !__APPLE__ */ @@ -155,7 +155,7 @@ void semaphore::wait() noexcept } } -int semaphore::trywait() noexcept +bool semaphore::try_wait() noexcept { return sem_trywait(&mSem) == 0; } #endif /* __APPLE__ */ diff --git a/common/threads.h b/common/threads.h index 7eb2d608..8a640390 100644 --- a/common/threads.h +++ b/common/threads.h @@ -47,7 +47,7 @@ public: void post(); void wait() noexcept; - int trywait() noexcept; + bool try_wait() noexcept; }; } // namespace al |