Skip to content

Commit af270b0

Browse files
committed
Update dpf, tweaks to semaphore
Signed-off-by: falkTX <falktx@falktx.com>
1 parent cf3a30f commit af270b0

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

plugins/common/Semaphore.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,20 @@ class Semaphore
3333
Semaphore(const int initialValue = 0)
3434
{
3535
#if defined(DISTRHO_OS_MAC)
36-
DISTRHO_SAFE_ASSERT_RETURN(semaphore_create(mach_task_self(),
37-
&sem,
38-
SYNC_POLICY_FIFO,
39-
initialValue) == KERN_SUCCESS,);
36+
task = mach_task_self();
37+
DISTRHO_SAFE_ASSERT_RETURN(semaphore_create(task, &sem, SYNC_POLICY_FIFO, initialValue) == KERN_SUCCESS,);
4038
#elif defined(DISTRHO_OS_WINDOWS)
4139
handle = ::CreateSemaphoreA(nullptr, initialValue, std::max(initialValue, 1), nullptr);
4240
DISTRHO_SAFE_ASSERT_RETURN(handle != INVALID_HANDLE_VALUE,);
4341
#else
44-
::sem_init(&sem, 0, initialValue);
42+
DISTRHO_SAFE_ASSERT_RETURN(::sem_init(&sem, 0, initialValue) == 0,);
4543
#endif
4644
}
4745

4846
~Semaphore()
4947
{
5048
#if defined(DISTRHO_OS_MAC)
51-
::semaphore_destroy(mach_task_self(), sem);
49+
::semaphore_destroy(task, sem);
5250
#elif defined(DISTRHO_OS_WINDOWS)
5351
::CloseHandle(handle);
5452
#else
@@ -95,6 +93,7 @@ class Semaphore
9593

9694
private:
9795
#if defined(DISTRHO_OS_MAC)
96+
::mach_port_t task;
9897
::semaphore_t sem;
9998
#elif defined(DISTRHO_OS_WINDOWS)
10099
::HANDLE handle;

0 commit comments

Comments
 (0)