mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Fixed semaphore on OSX.
This commit is contained in:
@@ -107,7 +107,7 @@
|
||||
#endif // BX_CONFIG_CRT_FILE_READER_WRITER
|
||||
|
||||
#ifndef BX_CONFIG_SEMAPHORE_PTHREAD
|
||||
# define BX_CONFIG_SEMAPHORE_PTHREAD 0
|
||||
# define BX_CONFIG_SEMAPHORE_PTHREAD BX_PLATFORM_OSX|BX_PLATFORM_IOS
|
||||
#endif // BX_CONFIG_SEMAPHORE_PTHREAD
|
||||
|
||||
#endif // __BX_MACROS_H__
|
||||
|
||||
@@ -75,6 +75,14 @@ namespace bx
|
||||
int result = pthread_mutex_lock(&m_mutex);
|
||||
BX_CHECK(0 == result, "pthread_mutex_lock %d", result);
|
||||
|
||||
# if BX_PLATFORM_NACL || BX_PLATFORM_OSX
|
||||
BX_CHECK(-1 == _msecs, "NaCl and OSX don't support pthread_cond_timedwait at this moment.");
|
||||
while (0 == result
|
||||
&& 0 >= m_count)
|
||||
{
|
||||
result = pthread_cond_wait(&m_cond, &m_mutex);
|
||||
}
|
||||
# else
|
||||
timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
ts.tv_sec += _msecs/1000;
|
||||
@@ -85,7 +93,7 @@ namespace bx
|
||||
{
|
||||
result = pthread_cond_timedwait(&m_cond, &m_mutex, &ts);
|
||||
}
|
||||
|
||||
# endif // BX_PLATFORM_NACL || BX_PLATFORM_OSX
|
||||
bool ok = 0 == result;
|
||||
|
||||
if (ok)
|
||||
|
||||
Reference in New Issue
Block a user