Commit 1a56f625 authored by sletz's avatar sletz
Browse files

Tim Blechmann patch for JackPosixSemaphore (still to test...).

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2381 0c269be4-1314-0410-8aa9-9f06e86f4224
parent fa9eae4c
......@@ -20,6 +20,10 @@ Fernando Lopez-Lezcano
Jackdmp changes log
---------------------------
2008-05-29 Stephane Letz <letz@grame.fr>
* Tim Blechmann patch for JackPosixSemaphore (still to test...).
2008-05-28 Stephane Letz <letz@grame.fr>
* New testMutex test, correct timing in drivers.
......
......@@ -97,10 +97,9 @@ bool JackPosixSemaphore::Wait()
}
/*
#ifdef __linux__
#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) // glibc feature test
bool JackPosixSemaphore::TimedWait(long usec) // unusable semantic !!
bool JackPosixSemaphore::TimedWait(long usec)
{
int res;
struct timeval now;
......@@ -112,7 +111,11 @@ bool JackPosixSemaphore::TimedWait(long usec) // unusable semantic !!
}
gettimeofday(&now, 0);
time.tv_sec = now.tv_sec + usec / 1000000;
time.tv_nsec = (now.tv_usec + (usec % 1000000)) * 1000;
long tv_usec = (now.tv_usec + (usec % 1000000));
time.tv_sec += tv_usec / 1000000;
time.tv_nsec = (tv_usec % 1000000) * 1000;
if ((res = sem_timedwait(fSemaphore, &time)) != 0) {
jack_error("JackPosixSemaphore::TimedWait err = %s", strerror(errno));
......@@ -130,14 +133,6 @@ bool JackPosixSemaphore::TimedWait(long usec)
return Wait();
}
#endif
*/
#warning JackPosixSemaphore::TimedWait not available : synchronous mode may not work correctly if POSIX semaphore are used
bool JackPosixSemaphore::TimedWait(long usec)
{
return Wait();
}
// Server side : publish the semaphore in the global namespace
bool JackPosixSemaphore::Allocate(const char* name, const char* server_name, int value)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment