From 748381a2f0610bbedd1174f58b4adb2e254edf17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Wed, 15 Feb 2017 22:54:48 -0800 Subject: [PATCH] Fixed build. --- src/semaphore.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/semaphore.cpp b/src/semaphore.cpp index a3718fc..3fb2aaa 100644 --- a/src/semaphore.cpp +++ b/src/semaphore.cpp @@ -47,11 +47,11 @@ namespace bx # if BX_CONFIG_SEMAPHORE_PTHREAD Semaphore::Semaphore() - : m_count(0) { BX_STATIC_ASSERT(sizeof(SemaphoreInternal) <= sizeof(m_internal) ); SemaphoreInternal* si = (SemaphoreInternal*)m_internal; + si->m_count = 0; int result; @@ -91,7 +91,7 @@ namespace bx BX_CHECK(0 == result, "pthread_cond_signal %d", result); } - m_count += _count; + si->m_count += _count; result = pthread_mutex_unlock(&si->m_mutex); BX_CHECK(0 == result, "pthread_mutex_unlock %d", result); @@ -110,7 +110,7 @@ namespace bx BX_UNUSED(_msecs); BX_CHECK(-1 == _msecs, "NaCl and OSX don't support pthread_cond_timedwait at this moment."); while (0 == result - && 0 >= m_count) + && 0 >= si->m_count) { result = pthread_cond_wait(&si->m_cond, &si->m_mutex); } @@ -118,7 +118,7 @@ namespace bx if (-1 == _msecs) { while (0 == result - && 0 >= m_count) + && 0 >= si->m_count) { result = pthread_cond_wait(&si->m_cond, &si->m_mutex); } @@ -130,7 +130,7 @@ namespace bx ts.tv_nsec = (_msecs%1000)*1000; while (0 == result - && 0 >= m_count) + && 0 >= si->m_count) { result = pthread_cond_timedwait_relative_np(&si->m_cond, &si->m_mutex, &ts); } @@ -142,7 +142,7 @@ namespace bx ts.tv_nsec += (_msecs%1000)*1000; while (0 == result - && 0 >= m_count) + && 0 >= si->m_count) { result = pthread_cond_timedwait(&si->m_cond, &si->m_mutex, &ts); } @@ -151,7 +151,7 @@ namespace bx if (ok) { - --m_count; + --si->m_count; } result = pthread_mutex_unlock(&si->m_mutex);