extracted clock_gettime in order to support MACH architecture

This commit is contained in:
john30
2015-11-07 11:56:39 +01:00
parent b4f89ab5dc
commit 0045d1cec4
6 changed files with 89 additions and 4 deletions
+4 -1
View File
@@ -23,6 +23,7 @@
#endif
#include "thread.h"
#include "clock.h"
void* Thread::runThread(void* arg)
{
@@ -46,7 +47,9 @@ bool Thread::start(const char* name)
if (result == 0) {
#ifdef HAVE_PTHREAD_SETNAME_NP
#ifndef __MACH__
pthread_setname_np(m_threadid, name);
#endif
#endif
m_started = true;
@@ -112,7 +115,7 @@ bool WaitThread::join()
bool WaitThread::Wait(int seconds)
{
struct timespec t;
clock_gettime(CLOCK_REALTIME, &t);
clockGettime(&t);
t.tv_sec += seconds;
pthread_mutex_lock(&m_mutex);
pthread_cond_timedwait(&m_cond, &m_mutex, &t);