Skip to content

Commit

Permalink
Fixed build.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Feb 16, 2017
1 parent 4e2f6ff commit 748381a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/semaphore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand All @@ -110,15 +110,15 @@ 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);
}
# elif BX_PLATFORM_IOS
if (-1 == _msecs)
{
while (0 == result
&& 0 >= m_count)
&& 0 >= si->m_count)
{
result = pthread_cond_wait(&si->m_cond, &si->m_mutex);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -151,7 +151,7 @@ namespace bx

if (ok)
{
--m_count;
--si->m_count;
}

result = pthread_mutex_unlock(&si->m_mutex);
Expand Down

0 comments on commit 748381a

Please sign in to comment.