Commit c58666dd authored by sletz's avatar sletz
Browse files

Rename JackProcessSync in JackPosixProcessSync.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4739 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 1204ad01
......@@ -36,6 +36,10 @@ John Emmas
Jackdmp changes log
---------------------------
2012-01-27 Stephane Letz <letz@grame.fr>
* Rename JackProcessSync in JackPosixProcessSync.
2012-01-26 Stephane Letz <letz@grame.fr>
* Add EndTime function (especially for Windows).
......
......@@ -74,7 +74,7 @@ def build(bld):
common_libsources += [
'../posix/JackPosixThread.cpp',
'../posix/JackPosixSemaphore.cpp',
'../posix/JackProcessSync.cpp',
'../posix/JackPosixProcessSync.cpp',
'../posix/JackPosixMutex.cpp',
'../posix/JackSocket.cpp',
'../linux/JackLinuxTime.c',
......@@ -87,7 +87,7 @@ def build(bld):
common_libsources += [
'../posix/JackPosixThread.cpp',
'../posix/JackFifo.cpp',
'../posix/JackProcessSync.cpp',
'../posix/JackPosixProcessSync.cpp',
'../posix/JackPosixMutex.cpp',
'../posix/JackSocket.cpp',
'../solaris/JackSolarisTime.c',
......@@ -97,7 +97,7 @@ def build(bld):
if bld.env['IS_MACOSX']:
common_libsources += [
'../posix/JackProcessSync.cpp',
'../posix/JackPosixProcessSync.cpp',
'../posix/JackPosixThread.cpp',
'../macosx/JackMachThread.cpp',
'../macosx/JackMachSemaphore.cpp',
......
......@@ -63,9 +63,9 @@ namespace Jack { typedef JackPosixSemaphore JackSynchro; }
namespace Jack { typedef JackClientSocket JackChannelTransaction; }
*/
#include "JackProcessSync.h"
/* __JackPlatformProcessSync__ */
/* Only on windows a special JackProcessSync is used. It is directly defined by including JackProcessSync.h here */
#include "JackPosixProcessSync.h"
namespace Jack { typedef JackPosixProcessSync JackProcessSync; }
/* __JackPlatformServerChannel__ */
#include "JackSocketServerChannel.h"
......
......@@ -65,8 +65,8 @@ namespace Jack { typedef JackMachSemaphore JackSynchro; }
#endif
/* __JackPlatformProcessSync__ */
#include "JackProcessSync.h"
/* Only on windows a special JackProcessSync is used. It is directly defined by including JackProcessSync.h here */
#include "JackPosixProcessSync.h"
namespace Jack { typedef JackPosixProcessSync JackProcessSync; }
#ifndef MY_TARGET_OS_IPHONE
/* __JackPlatformServerChannel__ */
......
This diff is collapsed.
/*
/*
Copyright (C) 2004-2008 Grame
This program is free software; you can redistribute it and/or modify
......@@ -17,84 +17,84 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "JackProcessSync.h"
#include "JackPosixProcessSync.h"
#include "JackError.h"
namespace Jack
{
void JackProcessSync::Signal()
void JackPosixProcessSync::Signal()
{
int res = pthread_cond_signal(&fCond);
if (res != 0)
jack_error("JackProcessSync::Signal error err = %s", strerror(res));
jack_error("JackPosixProcessSync::Signal error err = %s", strerror(res));
}
// TO DO : check thread consistency?
void JackProcessSync::LockedSignal()
void JackPosixProcessSync::LockedSignal()
{
int res = pthread_mutex_lock(&fMutex);
if (res != 0)
jack_error("JackProcessSync::LockedSignal error err = %s", strerror(res));
jack_error("JackPosixProcessSync::LockedSignal error err = %s", strerror(res));
res = pthread_cond_signal(&fCond);
if (res != 0)
jack_error("JackProcessSync::LockedSignal error err = %s", strerror(res));
jack_error("JackPosixProcessSync::LockedSignal error err = %s", strerror(res));
res = pthread_mutex_unlock(&fMutex);
if (res != 0)
jack_error("JackProcessSync::LockedSignal error err = %s", strerror(res));
jack_error("JackPosixProcessSync::LockedSignal error err = %s", strerror(res));
}
void JackProcessSync::SignalAll()
void JackPosixProcessSync::SignalAll()
{
int res = pthread_cond_broadcast(&fCond);
if (res != 0)
jack_error("JackProcessSync::SignalAll error err = %s", strerror(res));
jack_error("JackPosixProcessSync::SignalAll error err = %s", strerror(res));
}
// TO DO : check thread consistency?
void JackProcessSync::LockedSignalAll()
void JackPosixProcessSync::LockedSignalAll()
{
int res = pthread_mutex_lock(&fMutex);
if (res != 0)
jack_error("JackProcessSync::LockedSignalAll error err = %s", strerror(res));
jack_error("JackPosixProcessSync::LockedSignalAll error err = %s", strerror(res));
res = pthread_cond_broadcast(&fCond);
if (res != 0)
jack_error("JackProcessSync::LockedSignalAll error err = %s", strerror(res));
jack_error("JackPosixProcessSync::LockedSignalAll error err = %s", strerror(res));
res = pthread_mutex_unlock(&fMutex);
if (res != 0)
jack_error("JackProcessSync::LockedSignalAll error err = %s", strerror(res));
jack_error("JackPosixProcessSync::LockedSignalAll error err = %s", strerror(res));
}
void JackProcessSync::Wait()
void JackPosixProcessSync::Wait()
{
ThrowIf(!pthread_equal(pthread_self(), fOwner), JackException("JackProcessSync::Wait: a thread has to have locked a mutex before it can wait"));
ThrowIf(!pthread_equal(pthread_self(), fOwner), JackException("JackPosixProcessSync::Wait: a thread has to have locked a mutex before it can wait"));
fOwner = 0;
int res = pthread_cond_wait(&fCond, &fMutex);
if (res != 0) {
jack_error("JackProcessSync::Wait error err = %s", strerror(res));
jack_error("JackPosixProcessSync::Wait error err = %s", strerror(res));
} else {
fOwner = pthread_self();
}
}
// TO DO : check thread consistency?
void JackProcessSync::LockedWait()
void JackPosixProcessSync::LockedWait()
{
int res;
res = pthread_mutex_lock(&fMutex);
if (res != 0)
jack_error("JackProcessSync::LockedWait error err = %s", strerror(res));
jack_error("JackPosixProcessSync::LockedWait error err = %s", strerror(res));
if ((res = pthread_cond_wait(&fCond, &fMutex)) != 0)
jack_error("JackProcessSync::LockedWait error err = %s", strerror(res));
jack_error("JackPosixProcessSync::LockedWait error err = %s", strerror(res));
res = pthread_mutex_unlock(&fMutex);
if (res != 0)
jack_error("JackProcessSync::LockedWait error err = %s", strerror(res));
jack_error("JackPosixProcessSync::LockedWait error err = %s", strerror(res));
}
bool JackProcessSync::TimedWait(long usec)
bool JackPosixProcessSync::TimedWait(long usec)
{
ThrowIf(!pthread_equal(pthread_self(), fOwner), JackException("JackProcessSync::TimedWait: a thread has to have locked a mutex before it can wait"));
ThrowIf(!pthread_equal(pthread_self(), fOwner), JackException("JackPosixProcessSync::TimedWait: a thread has to have locked a mutex before it can wait"));
fOwner = 0;
struct timeval T0, T1;
......@@ -102,7 +102,7 @@ bool JackProcessSync::TimedWait(long usec)
struct timeval now;
int res;
jack_log("JackProcessSync::TimedWait time out = %ld", usec);
jack_log("JackPosixProcessSync::TimedWait time out = %ld", usec);
gettimeofday(&T0, 0);
gettimeofday(&now, 0);
......@@ -112,20 +112,20 @@ bool JackProcessSync::TimedWait(long usec)
res = pthread_cond_timedwait(&fCond, &fMutex, &time);
if (res != 0) {
jack_error("JackProcessSync::TimedWait error usec = %ld err = %s", usec, strerror(res));
jack_error("JackPosixProcessSync::TimedWait error usec = %ld err = %s", usec, strerror(res));
} else {
fOwner = pthread_self();
}
gettimeofday(&T1, 0);
jack_log("JackProcessSync::TimedWait finished delta = %5.1lf",
jack_log("JackPosixProcessSync::TimedWait finished delta = %5.1lf",
(1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec));
return (res == 0);
}
// TO DO : check thread consistency?
bool JackProcessSync::LockedTimedWait(long usec)
bool JackPosixProcessSync::LockedTimedWait(long usec)
{
struct timeval T0, T1;
timespec time;
......@@ -134,9 +134,9 @@ bool JackProcessSync::LockedTimedWait(long usec)
res1 = pthread_mutex_lock(&fMutex);
if (res1 != 0)
jack_error("JackProcessSync::LockedTimedWait error err = %s", usec, strerror(res1));
jack_error("JackPosixProcessSync::LockedTimedWait error err = %s", usec, strerror(res1));
jack_log("JackProcessSync::TimedWait time out = %ld", usec);
jack_log("JackPosixProcessSync::TimedWait time out = %ld", usec);
gettimeofday(&T0, 0);
gettimeofday(&now, 0);
......@@ -145,14 +145,14 @@ bool JackProcessSync::LockedTimedWait(long usec)
time.tv_nsec = (next_date_usec % 1000000) * 1000;
res2 = pthread_cond_timedwait(&fCond, &fMutex, &time);
if (res2 != 0)
jack_error("JackProcessSync::LockedTimedWait error usec = %ld err = %s", usec, strerror(res2));
jack_error("JackPosixProcessSync::LockedTimedWait error usec = %ld err = %s", usec, strerror(res2));
gettimeofday(&T1, 0);
res1 = pthread_mutex_unlock(&fMutex);
if (res1 != 0)
jack_error("JackProcessSync::LockedTimedWait error err = %s", usec, strerror(res1));
jack_error("JackPosixProcessSync::LockedTimedWait error err = %s", usec, strerror(res1));
jack_log("JackProcessSync::TimedWait finished delta = %5.1lf",
jack_log("JackPosixProcessSync::TimedWait finished delta = %5.1lf",
(1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec));
return (res2 == 0);
......
......@@ -17,10 +17,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __JackProcessSync__
#define __JackProcessSync__
#ifndef __JackPosixProcessSync__
#define __JackPosixProcessSync__
#include "JackPlatformPlug.h"
#include "JackPosixMutex.h"
#include "JackException.h"
#include <sys/time.h>
......@@ -30,10 +29,10 @@ namespace Jack
{
/*!
\brief A synchronization primitive built using a condition variable.
\brief A synchronization primitive built using a condition variable.
*/
class JackProcessSync : public JackBasePosixMutex
class JackPosixProcessSync : public JackBasePosixMutex
{
private:
......@@ -42,13 +41,13 @@ class JackProcessSync : public JackBasePosixMutex
public:
JackProcessSync():JackBasePosixMutex()
JackPosixProcessSync():JackBasePosixMutex()
{
int res = pthread_cond_init(&fCond, NULL);
ThrowIf(res != 0, JackException("JackBasePosixMutex: could not init the cond variable"));
}
virtual ~JackProcessSync()
virtual ~JackPosixProcessSync()
{
pthread_cond_destroy(&fCond);
}
......
......@@ -57,9 +57,9 @@ namespace Jack { typedef JackFifo JackSynchro; }
#include "JackSocket.h"
namespace Jack { typedef JackClientSocket JackChannelTransaction; }
#include "JackProcessSync.h"
/* __JackPlatformProcessSync__ */
/* Only on windows a special JackProcessSync is used. It is directly defined by including JackProcessSync.h here */
#include "JackPosixProcessSync.h"
namespace Jack { typedef JackPosixProcessSync JackProcessSync; }
/* __JackPlatformServerChannel__ */
#include "JackSocketServerChannel.h"
......
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