Merge with c53f510976d631f0602c377e31010184e35bce79

This commit is contained in:
miha_vitorovic
2011-01-06 15:00:26 +01:00
2 changed files with 7 additions and 2 deletions

View File

@@ -41,6 +41,10 @@ ReferenceCountingLock::~ReferenceCountingLock()
bool ReferenceCountingLock::acquire(int64 msecs)
{
#ifdef darwin
// timedlock not supported by Darwin OS
return (pthread_mutex_lock(&_mutex) == 0);
#else
struct timespec deltatime;
deltatime.tv_sec = msecs / 1000;
deltatime.tv_nsec = (msecs % 1000) * 1000;
@@ -51,6 +55,7 @@ bool ReferenceCountingLock::acquire(int64 msecs)
return true;
}
return false;
#endif
}
void ReferenceCountingLock::release()

View File

@@ -156,7 +156,7 @@ void* testWorker2(void* p)
assert(namedGuard.acquireSynchronizationObject(addr,timeout));
usleep(1);
}
#ifndef darwin
//this thread sleeps a while and gets timeout on lock
{
sleep(1);
@@ -167,7 +167,7 @@ void* testWorker2(void* p)
NamedLock<osiSockAddr,comp_osiSockAddr> namedGuard(namedLockPattern);
assert(!namedGuard.acquireSynchronizationObject(addr,timeout));
}
#endif
return NULL;
}