From 004016f2e9ea20e03f0510337d69854261abcfec Mon Sep 17 00:00:00 2001 From: sletz Date: Tue, 17 Feb 2009 08:14:11 +0000 Subject: [PATCH] Rework the mutex/signal classes. Use them in JackMessageBuffer. git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@3319 0c269be4-1314-0410-8aa9-9f06e86f4224 --- ChangeLog | 6 +- common/JackAudioAdapterInterface.h | 1 - common/JackEngine.cpp | 16 +-- common/JackFilters.h | 1 - common/JackMessageBuffer.cpp | 25 ++-- common/JackMessageBuffer.h | 4 +- common/JackNetAdapter.h | 1 - common/JackNetTool.h | 5 +- macosx/JackMachSemaphore.cpp | 20 ++- macosx/JackMachSemaphore.h | 3 - macosx/JackPlatformPlug_os.h | 2 + macosx/Jackdmp.xcodeproj/project.pbxproj | 160 ++++++++++++----------- posix/JackPosixMutex.h | 7 +- posix/JackPosixThread.cpp | 1 + posix/JackProcessSync.cpp | 108 ++++++++++++--- posix/JackProcessSync.h | 97 ++------------ windows/JackWinMutex.h | 5 +- windows/JackWinProcessSync.cpp | 58 +++++++- windows/JackWinProcessSync.h | 42 ++---- 19 files changed, 306 insertions(+), 256 deletions(-) diff --git a/ChangeLog b/ChangeLog index e09f1369..fd7ab50a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,10 +23,14 @@ Michael Voigt Jackdmp changes log --------------------------- +2009-02-16 Stephane Letz + + * Rework the mutex/signal classes. Use them in JackMessageBuffer. + 2009-02-11 Stephane Letz * Merge Solaris branch back on trunk. - * Equality of input and output buffer size removed (for now) in JackOSSDriver. + * Equality of input and output buffer size removed (for now) in JackOSSDriver. 2009-02-10 Stephane Letz diff --git a/common/JackAudioAdapterInterface.h b/common/JackAudioAdapterInterface.h index aa1edd25..c7edf1bd 100644 --- a/common/JackAudioAdapterInterface.h +++ b/common/JackAudioAdapterInterface.h @@ -24,7 +24,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include "jack.h" #include "JackError.h" #include "JackResampler.h" -#include "JackConstants.h" #include "JackFilters.h" #include diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index 5a098214..03d7f91b 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -86,7 +86,6 @@ int JackEngine::Close() } } - fSignal.Destroy(); return 0; } @@ -135,7 +134,7 @@ void JackEngine::ProcessNext(jack_time_t cur_cycle_begin) fLastSwitchUsecs = cur_cycle_begin; if (fGraphManager->RunNextGraph()) // True if the graph actually switched to a new state fChannel.Notify(ALL_CLIENTS, kGraphOrderCallback, 0); - fSignal.SignalAll(); // Signal for threads waiting for next cycle + fSignal.Signal(); // Signal for threads waiting for next cycle } void JackEngine::ProcessCurrent(jack_time_t cur_cycle_begin) @@ -148,7 +147,7 @@ void JackEngine::ProcessCurrent(jack_time_t cur_cycle_begin) bool JackEngine::Process(jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end) { bool res = true; - + // Cycle begin fEngineControl->CycleBegin(fClientTable, fGraphManager, cur_cycle_begin, prev_cycle_end); @@ -174,7 +173,6 @@ bool JackEngine::Process(jack_time_t cur_cycle_begin, jack_time_t prev_cycle_end return res; } - /* Client that finish *after* the callback date are considered late even if their output buffers may have been correctly mixed in the time window: callbackUsecs <==> Read <==> Write. @@ -501,7 +499,7 @@ int JackEngine::ClientExternalOpen(const char* name, int pid, int* ref, int* sha goto error; } - if (!fSignal.TimedWait(DRIVER_OPEN_TIMEOUT * 1000000)) { + if (!fSignal.LockedTimedWait(DRIVER_OPEN_TIMEOUT * 1000000)) { // Failure if RT thread is not running (problem with the driver...) jack_error("Driver is not running"); goto error; @@ -546,7 +544,7 @@ int JackEngine::ClientInternalOpen(const char* name, int* ref, JackEngineControl goto error; } - if (wait && !fSignal.TimedWait(DRIVER_OPEN_TIMEOUT * 1000000)) { + if (wait && !fSignal.LockedTimedWait(DRIVER_OPEN_TIMEOUT * 1000000)) { // Failure if RT thread is not running (problem with the driver...) jack_error("Driver is not running"); goto error; @@ -624,7 +622,7 @@ int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wai // Wait until next cycle to be sure client is not used anymore if (wait) { - if (!fSignal.TimedWait(fEngineControl->fTimeOutUsecs * 2)) { // Must wait at least until a switch occurs in Process, even in case of graph end failure + if (!fSignal.LockedTimedWait(fEngineControl->fTimeOutUsecs * 2)) { // Must wait at least until a switch occurs in Process, even in case of graph end failure jack_error("JackEngine::ClientCloseAux wait error ref = %ld", refnum); } } @@ -649,7 +647,7 @@ int JackEngine::ClientActivate(int refnum, bool state) fGraphManager->Activate(refnum); // Wait for graph state change to be effective - if (!fSignal.TimedWait(fEngineControl->fTimeOutUsecs * 10)) { + if (!fSignal.LockedTimedWait(fEngineControl->fTimeOutUsecs * 10)) { jack_error("JackEngine::ClientActivate wait error ref = %ld name = %s", refnum, client->GetClientControl()->fName); return -1; } else { @@ -686,7 +684,7 @@ int JackEngine::ClientDeactivate(int refnum) fLastSwitchUsecs = 0; // Force switch to occur next cycle, even when called with "dead" clients // Wait for graph state change to be effective - if (!fSignal.TimedWait(fEngineControl->fTimeOutUsecs * 10)) { + if (!fSignal.LockedTimedWait(fEngineControl->fTimeOutUsecs * 10)) { jack_error("JackEngine::ClientDeactivate wait error ref = %ld name = %s", refnum, client->GetClientControl()->fName); return -1; } else { diff --git a/common/JackFilters.h b/common/JackFilters.h index 638b02ff..a7fb3366 100644 --- a/common/JackFilters.h +++ b/common/JackFilters.h @@ -23,7 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include "jack.h" #include "JackAtomicState.h" #include -#include namespace Jack { diff --git a/common/JackMessageBuffer.cpp b/common/JackMessageBuffer.cpp index f558fdc6..18e4d52f 100644 --- a/common/JackMessageBuffer.cpp +++ b/common/JackMessageBuffer.cpp @@ -31,6 +31,7 @@ JackMessageBuffer* JackMessageBuffer::fInstance = NULL; JackMessageBuffer::JackMessageBuffer() :fThread(this),fInBuffer(0),fOutBuffer(0),fOverruns(0) { + fRunning = true; fThread.StartSync(); } @@ -41,7 +42,11 @@ JackMessageBuffer::~JackMessageBuffer() } else { jack_info("no message buffer overruns"); } - fThread.Kill(); + fGuard.Lock(); + fRunning = false; + fGuard.Signal(); + fGuard.Unlock(); + fThread.Stop(); Flush(); } @@ -55,12 +60,12 @@ void JackMessageBuffer::Flush() void JackMessageBuffer::AddMessage(int level, const char *message) { - if (fMutex.Trylock()) { + if (fGuard.Trylock()) { fBuffers[fInBuffer].level = level; strncpy(fBuffers[fInBuffer].message, message, MB_BUFFERSIZE); fInBuffer = MB_NEXT(fInBuffer); - fSignal.SignalAll(); - fMutex.Unlock(); + fGuard.Signal(); + fGuard.Unlock(); } else { /* lock collision */ INC_ATOMIC(&fOverruns); } @@ -68,11 +73,13 @@ void JackMessageBuffer::AddMessage(int level, const char *message) bool JackMessageBuffer::Execute() { - fSignal.Wait(); - fMutex.Lock(); - Flush(); - fMutex.Unlock(); - return true; + while (fRunning) { + fGuard.Lock(); + fGuard.Wait(); + Flush(); + fGuard.Unlock(); + } + return false; } void JackMessageBuffer::Create() diff --git a/common/JackMessageBuffer.h b/common/JackMessageBuffer.h index 9225dec3..23bb12a6 100644 --- a/common/JackMessageBuffer.h +++ b/common/JackMessageBuffer.h @@ -58,12 +58,12 @@ class JackMessageBuffer : public JackRunnableInterface private: JackMessage fBuffers[MB_BUFFERS]; - JackMutex fMutex; JackThread fThread; - JackProcessSync fSignal; + JackProcessSync fGuard; volatile unsigned int fInBuffer; volatile unsigned int fOutBuffer; SInt32 fOverruns; + bool fRunning; void Flush(); diff --git a/common/JackNetAdapter.h b/common/JackNetAdapter.h index 72cdbf84..8d935216 100644 --- a/common/JackNetAdapter.h +++ b/common/JackNetAdapter.h @@ -22,7 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include #include "JackAudioAdapterInterface.h" -#include "JackPlatformPlug.h" #include "JackNetInterface.h" namespace Jack diff --git a/common/JackNetTool.h b/common/JackNetTool.h index f0413dad..e7c0e8d6 100644 --- a/common/JackNetTool.h +++ b/common/JackNetTool.h @@ -17,14 +17,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "JackConstants.h" #include "JackMidiPort.h" #include "JackTools.h" #include "JackPlatformPlug.h" #include "types.h" -#include "transport.h" +#include "transport.h" #ifndef WIN32 -#include +#include #endif #include diff --git a/macosx/JackMachSemaphore.cpp b/macosx/JackMachSemaphore.cpp index 67df3edb..ee1b2ebd 100644 --- a/macosx/JackMachSemaphore.cpp +++ b/macosx/JackMachSemaphore.cpp @@ -34,8 +34,6 @@ void JackMachSemaphore::BuildName(const char* name, const char* server_name, cha bool JackMachSemaphore::Signal() { - kern_return_t res; - if (!fSemaphore) { jack_error("JackMachSemaphore::Signal name = %s already desallocated!!", fName); return false; @@ -44,6 +42,7 @@ bool JackMachSemaphore::Signal() if (fFlush) return true; + kern_return_t res; if ((res = semaphore_signal(fSemaphore)) != KERN_SUCCESS) { jack_error("JackMachSemaphore::Signal name = %s err = %s", fName, mach_error_string(res)); } @@ -52,8 +51,6 @@ bool JackMachSemaphore::Signal() bool JackMachSemaphore::SignalAll() { - kern_return_t res; - if (!fSemaphore) { jack_error("JackMachSemaphore::SignalAll name = %s already desallocated!!", fName); return false; @@ -61,6 +58,8 @@ bool JackMachSemaphore::SignalAll() if (fFlush) return true; + + kern_return_t res; // When signaled several times, do not accumulate signals... if ((res = semaphore_signal_all(fSemaphore)) != KERN_SUCCESS) { jack_error("JackMachSemaphore::SignalAll name = %s err = %s", fName, mach_error_string(res)); @@ -70,13 +69,12 @@ bool JackMachSemaphore::SignalAll() bool JackMachSemaphore::Wait() { - kern_return_t res; - if (!fSemaphore) { jack_error("JackMachSemaphore::Wait name = %s already desallocated!!", fName); return false; } + kern_return_t res; if ((res = semaphore_wait(fSemaphore)) != KERN_SUCCESS) { jack_error("JackMachSemaphore::Wait name = %s err = %s", fName, mach_error_string(res)); } @@ -85,15 +83,15 @@ bool JackMachSemaphore::Wait() bool JackMachSemaphore::TimedWait(long usec) { - kern_return_t res; - mach_timespec time; - time.tv_sec = usec / 1000000; - time.tv_nsec = (usec % 1000000) * 1000; - if (!fSemaphore) { jack_error("JackMachSemaphore::TimedWait name = %s already desallocated!!", fName); return false; } + + kern_return_t res; + mach_timespec time; + time.tv_sec = usec / 1000000; + time.tv_nsec = (usec % 1000000) * 1000; if ((res = semaphore_timedwait(fSemaphore, time)) != KERN_SUCCESS) { jack_error("JackMachSemaphore::TimedWait name = %s usec = %ld err = %s", fName, usec, mach_error_string(res)); diff --git a/macosx/JackMachSemaphore.h b/macosx/JackMachSemaphore.h index cf5a007c..c82fa8d5 100644 --- a/macosx/JackMachSemaphore.h +++ b/macosx/JackMachSemaphore.h @@ -23,9 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "JackCompilerDeps.h" #include "JackSynchro.h" #include -#include -#include -#include #include #include diff --git a/macosx/JackPlatformPlug_os.h b/macosx/JackPlatformPlug_os.h index bdfae1c9..24d94252 100644 --- a/macosx/JackPlatformPlug_os.h +++ b/macosx/JackPlatformPlug_os.h @@ -47,6 +47,8 @@ namespace Jack { typedef JackMachSemaphore JackSynchro; } /* __JackPlatformProcessSync__ */ #include "JackProcessSync.h" +//#include "JackMachProcessSync.h" +//namespace Jack { typedef JackMachProcessSync JackProcessSync; } /* Only on windows a special JackProcessSync is used. It is directly defined by including JackProcessSync.h here */ /* __JackPlatformServerChannel__ */ diff --git a/macosx/Jackdmp.xcodeproj/project.pbxproj b/macosx/Jackdmp.xcodeproj/project.pbxproj index 3423db05..2e2c160a 100644 --- a/macosx/Jackdmp.xcodeproj/project.pbxproj +++ b/macosx/Jackdmp.xcodeproj/project.pbxproj @@ -483,11 +483,9 @@ 4B80D7ED0BA0D17400F035BB /* JackMidiAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E70BA0D17400F035BB /* JackMidiAPI.cpp */; }; 4B93F1990E87992100E4ECCD /* JackPosixThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */; }; 4B93F19A0E87992200E4ECCD /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; }; - 4B93F19B0E87992300E4ECCD /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6AA0E703B690066E42F /* JackProcessSync.cpp */; }; 4B93F19C0E87998200E4ECCD /* JackPosixServerLaunch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBBA0E878B9C003D2374 /* JackPosixServerLaunch.cpp */; }; 4B93F19D0E87998400E4ECCD /* JackPosixThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */; }; 4B93F19E0E87998400E4ECCD /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; }; - 4B93F19F0E87998600E4ECCD /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6AA0E703B690066E42F /* JackProcessSync.cpp */; }; 4B93F1C00E87A35400E4ECCD /* JackMachTime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBC80E878D24003D2374 /* JackMachTime.c */; }; 4B93F22B0E87A72500E4ECCD /* JackMachTime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBC80E878D24003D2374 /* JackMachTime.c */; }; 4B95BCAE0D913073000F7695 /* control.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B95BCAD0D913073000F7695 /* control.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -510,11 +508,11 @@ 4BA7BDD00DC22F4500AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BA7BDCB0DC22F4500AA3457 /* Jackservermp.framework */; }; 4BA7BDD10DC22F4500AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BA7BDCB0DC22F4500AA3457 /* Jackservermp.framework */; }; 4BA7BDD20DC22F4500AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BA7BDCB0DC22F4500AA3457 /* Jackservermp.framework */; }; - 4BA7BE0F0DC232A400AA3457 /* Jackdmp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackdmp.framework */; }; - 4BA7BE1A0DC2347500AA3457 /* Jackdmp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackdmp.framework */; }; - 4BA7BE200DC234FB00AA3457 /* Jackdmp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackdmp.framework */; }; - 4BA7BE240DC2350D00AA3457 /* Jackdmp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackdmp.framework */; }; - 4BA7BE270DC2352A00AA3457 /* Jackdmp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackdmp.framework */; }; + 4BA7BE0F0DC232A400AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */; }; + 4BA7BE1A0DC2347500AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */; }; + 4BA7BE200DC234FB00AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */; }; + 4BA7BE240DC2350D00AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */; }; + 4BA7BE270DC2352A00AA3457 /* Jackservermp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */; }; 4BA7FECA0D8E76650017FF73 /* control.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BA7FEC80D8E76650017FF73 /* control.c */; }; 4BAB95B80B9E20B800A0C723 /* JackPortType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BAB95B60B9E20B800A0C723 /* JackPortType.cpp */; }; 4BAB95B90B9E20B800A0C723 /* JackPortType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BAB95B70B9E20B800A0C723 /* JackPortType.h */; }; @@ -542,8 +540,6 @@ 4BC3B6A50E703B2E0066E42F /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; }; 4BC3B6A60E703B2E0066E42F /* JackPosixThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */; }; 4BC3B6A70E703B2E0066E42F /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; }; - 4BC3B6AB0E703B690066E42F /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6AA0E703B690066E42F /* JackProcessSync.cpp */; }; - 4BC3B6AC0E703B690066E42F /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6AA0E703B690066E42F /* JackProcessSync.cpp */; }; 4BC3B6BB0E703BCC0066E42F /* JackNetUnixSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6B90E703BCC0066E42F /* JackNetUnixSocket.cpp */; }; 4BC3B6BC0E703BCC0066E42F /* JackNetUnixSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6BA0E703BCC0066E42F /* JackNetUnixSocket.h */; }; 4BC3B6BD0E703BCC0066E42F /* JackNetUnixSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6B90E703BCC0066E42F /* JackNetUnixSocket.cpp */; }; @@ -568,6 +564,14 @@ 4BE5FED10E725C320020B576 /* JackCoreAudioAdapter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE5FECF0E725C320020B576 /* JackCoreAudioAdapter.cpp */; }; 4BE5FED20E725C320020B576 /* JackCoreAudioAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE5FED00E725C320020B576 /* JackCoreAudioAdapter.h */; }; 4BE6C6AD0A3E0A65005A203A /* test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE6C6AC0A3E0A65005A203A /* test.cpp */; }; + 4BECB2F50F4451C10091B70A /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */; }; + 4BECB2F60F4451C10091B70A /* JackProcessSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BECB2F40F4451C10091B70A /* JackProcessSync.h */; }; + 4BECB2F70F4451C10091B70A /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */; }; + 4BECB2F80F4451C10091B70A /* JackProcessSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BECB2F40F4451C10091B70A /* JackProcessSync.h */; }; + 4BECB2F90F4451C10091B70A /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */; }; + 4BECB2FA0F4451C10091B70A /* JackProcessSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BECB2F40F4451C10091B70A /* JackProcessSync.h */; }; + 4BECB2FB0F4451C10091B70A /* JackProcessSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */; }; + 4BECB2FC0F4451C10091B70A /* JackProcessSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BECB2F40F4451C10091B70A /* JackProcessSync.h */; }; 4BF284180F31B4BC00B05BE3 /* JackArgParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF284160F31B4BC00B05BE3 /* JackArgParser.cpp */; }; 4BF284190F31B4BC00B05BE3 /* JackArgParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF284170F31B4BC00B05BE3 /* JackArgParser.h */; }; 4BF2841A0F31B4BC00B05BE3 /* JackArgParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF284160F31B4BC00B05BE3 /* JackArgParser.cpp */; }; @@ -1161,7 +1165,7 @@ 4B0A28E60D52073D002EFF74 /* jack_thread_wait */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_thread_wait; sourceTree = BUILT_PRODUCTS_DIR; }; 4B0A28EC0D520852002EFF74 /* tw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tw.c; path = "../example-clients/tw.c"; sourceTree = SOURCE_ROOT; }; 4B0A292D0D52108E002EFF74 /* jack_thread_wait */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_thread_wait; sourceTree = BUILT_PRODUCTS_DIR; }; - 4B19B3000E23620F00DD4A82 /* netmanager.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = netmanager.so; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B19B3000E23620F00DD4A82 /* audioadapter.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = audioadapter.so; sourceTree = BUILT_PRODUCTS_DIR; }; 4B19B3060E2362E700DD4A82 /* JackAudioAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackAudioAdapter.cpp; path = ../common/JackAudioAdapter.cpp; sourceTree = SOURCE_ROOT; }; 4B19B3070E2362E700DD4A82 /* JackAudioAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackAudioAdapter.h; path = ../common/JackAudioAdapter.h; sourceTree = SOURCE_ROOT; }; 4B19B3080E2362E700DD4A82 /* JackAudioAdapterInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackAudioAdapterInterface.cpp; path = ../common/JackAudioAdapterInterface.cpp; sourceTree = SOURCE_ROOT; }; @@ -1173,7 +1177,7 @@ 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackGlobals.cpp; path = ../common/JackGlobals.cpp; sourceTree = SOURCE_ROOT; }; 4B35C4250D4731D1000DE7AE /* jackdmp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jackdmp; sourceTree = BUILT_PRODUCTS_DIR; }; 4B35C4830D4731D1000DE7AE /* Jackmp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackmp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 4B35C4FC0D4731D1000DE7AE /* Jackdmp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackdmp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Jackservermp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 4B35C5140D4731D1000DE7AE /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; 4B35C5200D4731D1000DE7AE /* jack_midisine */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midisine; sourceTree = BUILT_PRODUCTS_DIR; }; 4B35C52C0D4731D1000DE7AE /* jack_metro */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_metro; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1197,19 +1201,19 @@ 4B35C6290D4731D2000DE7AE /* jack_portaudio.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_portaudio.so; sourceTree = BUILT_PRODUCTS_DIR; }; 4B35C6340D4731D2000DE7AE /* jack_dummy.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_dummy.so; sourceTree = BUILT_PRODUCTS_DIR; }; 4B35C63E0D4731D3000DE7AE /* inprocess.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = inprocess.so; sourceTree = BUILT_PRODUCTS_DIR; }; - 4B363DD80DEB02F6001F72D9 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B363DD80DEB02F6001F72D9 /* jack_alias */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_alias; sourceTree = BUILT_PRODUCTS_DIR; }; 4B363DDE0DEB034E001F72D9 /* alias.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = alias.c; path = "../example-clients/alias.c"; sourceTree = SOURCE_ROOT; }; - 4B363E1A0DEB03C5001F72D9 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B363E1A0DEB03C5001F72D9 /* jack_evmon */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_evmon; sourceTree = BUILT_PRODUCTS_DIR; }; 4B363E200DEB0401001F72D9 /* evmon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = evmon.c; path = "../example-clients/evmon.c"; sourceTree = SOURCE_ROOT; }; - 4B363E4E0DEB0775001F72D9 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B363E4E0DEB0775001F72D9 /* jack_bufsize */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_bufsize; sourceTree = BUILT_PRODUCTS_DIR; }; 4B363E710DEB0808001F72D9 /* bufsize.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bufsize.c; path = "../example-clients/bufsize.c"; sourceTree = SOURCE_ROOT; }; - 4B363EE90DEB091C001F72D9 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B363EE90DEB091C001F72D9 /* jack_rec */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_rec; sourceTree = BUILT_PRODUCTS_DIR; }; 4B363EED0DEB094B001F72D9 /* capture_client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = capture_client.c; path = "../example-clients/capture_client.c"; sourceTree = SOURCE_ROOT; }; - 4B363F1E0DEB0A6A001F72D9 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B363F1E0DEB0A6A001F72D9 /* jack_monitor_client */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_monitor_client; sourceTree = BUILT_PRODUCTS_DIR; }; 4B363F220DEB0AB0001F72D9 /* monitor_client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = monitor_client.c; path = "../example-clients/monitor_client.c"; sourceTree = SOURCE_ROOT; }; - 4B363F350DEB0BD1001F72D9 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B363F350DEB0BD1001F72D9 /* jack_showtime */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_showtime; sourceTree = BUILT_PRODUCTS_DIR; }; 4B363F3D0DEB0C31001F72D9 /* showtime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = showtime.c; path = "../example-clients/showtime.c"; sourceTree = SOURCE_ROOT; }; - 4B363F720DEB0D4E001F72D9 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B363F720DEB0D4E001F72D9 /* jack_impulse_grabber */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_impulse_grabber; sourceTree = BUILT_PRODUCTS_DIR; }; 4B363F750DEB0D7D001F72D9 /* impulse_grabber.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = impulse_grabber.c; path = "../example-clients/impulse_grabber.c"; sourceTree = SOURCE_ROOT; }; 4B37C20306DF1FBE0016E567 /* CALatencyLog.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CALatencyLog.cpp; path = /Developer/Examples/CoreAudio/PublicUtility/CALatencyLog.cpp; sourceTree = ""; }; 4B37C20406DF1FBE0016E567 /* CALatencyLog.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CALatencyLog.h; path = /Developer/Examples/CoreAudio/PublicUtility/CALatencyLog.h; sourceTree = ""; }; @@ -1228,7 +1232,7 @@ 4B5A1BBD0CD1CC110005BF74 /* midiseq.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = midiseq.c; path = "../example-clients/midiseq.c"; sourceTree = SOURCE_ROOT; }; 4B5A1BDA0CD1CCE10005BF74 /* jack_midisine */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midisine; sourceTree = BUILT_PRODUCTS_DIR; }; 4B5A1BDC0CD1CD420005BF74 /* midisine.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = midisine.c; path = "../example-clients/midisine.c"; sourceTree = SOURCE_ROOT; }; - 4B5E08D50E5B66EE00BEE4E0 /* netmanager.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = netmanager.so; sourceTree = BUILT_PRODUCTS_DIR; }; + 4B5E08D50E5B66EE00BEE4E0 /* netadapter.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = netadapter.so; sourceTree = BUILT_PRODUCTS_DIR; }; 4B5E08DF0E5B676C00BEE4E0 /* JackNetAdapter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackNetAdapter.cpp; path = ../common/JackNetAdapter.cpp; sourceTree = SOURCE_ROOT; }; 4B5E08E00E5B676C00BEE4E0 /* JackNetAdapter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackNetAdapter.h; path = ../common/JackNetAdapter.h; sourceTree = SOURCE_ROOT; }; 4B5F253D0DEE9B8F0041E486 /* JackLockedEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackLockedEngine.h; path = ../common/JackLockedEngine.h; sourceTree = SOURCE_ROOT; }; @@ -1286,7 +1290,7 @@ 4BA692D40CBE4C9000EAD520 /* jack_unload */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_unload; sourceTree = BUILT_PRODUCTS_DIR; }; 4BA692D60CBE4CC600EAD520 /* ipunload.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ipunload.c; path = "../example-clients/ipunload.c"; sourceTree = SOURCE_ROOT; }; 4BA7BDCB0DC22F4500AA3457 /* Jackservermp.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Jackservermp.framework; path = build/Development/Jackservermp.framework; sourceTree = SOURCE_ROOT; }; - 4BA7FEC30D8E76270017FF73 /* jack_lsp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_lsp; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BA7FEC30D8E76270017FF73 /* jack_server_control */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_server_control; sourceTree = BUILT_PRODUCTS_DIR; }; 4BA7FEC80D8E76650017FF73 /* control.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = control.c; path = "../example-clients/control.c"; sourceTree = SOURCE_ROOT; }; 4BAB95B60B9E20B800A0C723 /* JackPortType.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackPortType.cpp; path = ../common/JackPortType.cpp; sourceTree = SOURCE_ROOT; }; 4BAB95B70B9E20B800A0C723 /* JackPortType.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackPortType.h; path = ../common/JackPortType.h; sourceTree = SOURCE_ROOT; }; @@ -1307,7 +1311,6 @@ 4BC3988A08B3CF6C00B6F371 /* JackDummyDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackDummyDriver.h; path = ../common/JackDummyDriver.h; sourceTree = SOURCE_ROOT; }; 4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackPosixThread.cpp; path = ../posix/JackPosixThread.cpp; sourceTree = SOURCE_ROOT; }; 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackPosixThread.h; path = ../posix/JackPosixThread.h; sourceTree = SOURCE_ROOT; }; - 4BC3B6AA0E703B690066E42F /* JackProcessSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackProcessSync.cpp; path = ../posix/JackProcessSync.cpp; sourceTree = SOURCE_ROOT; }; 4BC3B6AD0E703B8D0066E42F /* JackSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackSocket.cpp; path = ../posix/JackSocket.cpp; sourceTree = SOURCE_ROOT; }; 4BC3B6AE0E703B8D0066E42F /* JackSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackSocket.h; path = ../posix/JackSocket.h; sourceTree = SOURCE_ROOT; }; 4BC3B6AF0E703B8D0066E42F /* JackSocketClientChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackSocketClientChannel.cpp; path = ../posix/JackSocketClientChannel.cpp; sourceTree = SOURCE_ROOT; }; @@ -1338,6 +1341,8 @@ 4BE6C6A30A3E096F005A203A /* jack_test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_test; sourceTree = BUILT_PRODUCTS_DIR; }; 4BE6C6AC0A3E0A65005A203A /* test.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = test.cpp; path = ../tests/test.cpp; sourceTree = SOURCE_ROOT; }; 4BE99D300AD7A04800C59091 /* jack_cpu */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_cpu; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackProcessSync.cpp; path = ../posix/JackProcessSync.cpp; sourceTree = SOURCE_ROOT; }; + 4BECB2F40F4451C10091B70A /* JackProcessSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackProcessSync.h; path = ../posix/JackProcessSync.h; sourceTree = SOURCE_ROOT; }; 4BF284160F31B4BC00B05BE3 /* JackArgParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackArgParser.cpp; path = ../common/JackArgParser.cpp; sourceTree = SOURCE_ROOT; }; 4BF284170F31B4BC00B05BE3 /* JackArgParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackArgParser.h; path = ../common/JackArgParser.h; sourceTree = SOURCE_ROOT; }; 4BF3937C0626BF3600CC67FA /* JackMacLibClientRPC.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMacLibClientRPC.cpp; sourceTree = SOURCE_ROOT; }; @@ -1405,14 +1410,14 @@ 4BF8D2470834F20600C94B91 /* testSem.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = testSem.cpp; path = ../tests/testSem.cpp; sourceTree = SOURCE_ROOT; }; 4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackFrameTimer.cpp; path = ../common/JackFrameTimer.cpp; sourceTree = SOURCE_ROOT; }; 4BF8FB0E08AC88EF00D1A344 /* JackFrameTimer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackFrameTimer.h; path = ../common/JackFrameTimer.h; sourceTree = SOURCE_ROOT; }; - 4BFA5E980DEC4D9C00FA4CDB /* testSem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testSem; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BFA5E980DEC4D9C00FA4CDB /* testMutex */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testMutex; sourceTree = BUILT_PRODUCTS_DIR; }; 4BFA5E9E0DEC4DD900FA4CDB /* testMutex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testMutex.cpp; path = ../tests/testMutex.cpp; sourceTree = SOURCE_ROOT; }; - 4BFA828C0DF6A9E40087B4E1 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; - 4BFA829F0DF6A9E40087B4E1 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; - 4BFA82AB0DF6A9E40087B4E1 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; - 4BFA82B70DF6A9E40087B4E1 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; - 4BFA82C30DF6A9E40087B4E1 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; - 4BFA82CF0DF6A9E40087B4E1 /* jack_midiseq */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midiseq; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BFA828C0DF6A9E40087B4E1 /* jack_evmon */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_evmon; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BFA829F0DF6A9E40087B4E1 /* jack_bufsize */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_bufsize; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BFA82AB0DF6A9E40087B4E1 /* jack_rec */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_rec; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BFA82B70DF6A9E40087B4E1 /* jack_monitor_client */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_monitor_client; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BFA82C30DF6A9E40087B4E1 /* jack_showtime */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_showtime; sourceTree = BUILT_PRODUCTS_DIR; }; + 4BFA82CF0DF6A9E40087B4E1 /* jack_impulse_grabber */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_impulse_grabber; sourceTree = BUILT_PRODUCTS_DIR; }; 4BFA99A20AAAF3B0009E916C /* jdelay */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jdelay; sourceTree = BUILT_PRODUCTS_DIR; }; 4BFA99A90AAAF40C009E916C /* jdelay.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = jdelay.cpp; path = ../tests/jdelay.cpp; sourceTree = SOURCE_ROOT; }; 4BFB297708AF44ED00D450D4 /* JackMachServerNotifyChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachServerNotifyChannel.cpp; sourceTree = ""; }; @@ -1550,7 +1555,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4BA7BE0F0DC232A400AA3457 /* Jackdmp.framework in Frameworks */, + 4BA7BE0F0DC232A400AA3457 /* Jackservermp.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1558,7 +1563,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4BA7BE1A0DC2347500AA3457 /* Jackdmp.framework in Frameworks */, + 4BA7BE1A0DC2347500AA3457 /* Jackservermp.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1601,7 +1606,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4BA7BE200DC234FB00AA3457 /* Jackdmp.framework in Frameworks */, + 4BA7BE200DC234FB00AA3457 /* Jackservermp.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1609,7 +1614,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4BA7BE240DC2350D00AA3457 /* Jackdmp.framework in Frameworks */, + 4BA7BE240DC2350D00AA3457 /* Jackservermp.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1617,7 +1622,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4BA7BE270DC2352A00AA3457 /* Jackdmp.framework in Frameworks */, + 4BA7BE270DC2352A00AA3457 /* Jackservermp.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2042,7 +2047,7 @@ 4B5A1BDA0CD1CCE10005BF74 /* jack_midisine */, 4B35C4250D4731D1000DE7AE /* jackdmp */, 4B35C4830D4731D1000DE7AE /* Jackmp.framework */, - 4B35C4FC0D4731D1000DE7AE /* Jackdmp.framework */, + 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */, 4B35C5140D4731D1000DE7AE /* jack_midiseq */, 4B35C5200D4731D1000DE7AE /* jack_midisine */, 4B35C52C0D4731D1000DE7AE /* jack_metro */, @@ -2069,26 +2074,26 @@ 4B0A28E60D52073D002EFF74 /* jack_thread_wait */, 4B0A292D0D52108E002EFF74 /* jack_thread_wait */, 4B57F5950D72C27900B4E719 /* jack_thread_wait */, - 4BA7FEC30D8E76270017FF73 /* jack_lsp */, + 4BA7FEC30D8E76270017FF73 /* jack_server_control */, BA222ACF0DC88132001A17F4 /* jack_net.so */, BA222AE90DC882DB001A17F4 /* netmanager.so */, - 4BA7FEC30D8E76270017FF73 /* jack_lsp */, - 4B363DD80DEB02F6001F72D9 /* jack_midiseq */, - 4B363E1A0DEB03C5001F72D9 /* jack_midiseq */, - 4B363E4E0DEB0775001F72D9 /* jack_midiseq */, - 4B363EE90DEB091C001F72D9 /* jack_midiseq */, - 4B363F1E0DEB0A6A001F72D9 /* jack_midiseq */, - 4B363F350DEB0BD1001F72D9 /* jack_midiseq */, - 4B363F720DEB0D4E001F72D9 /* jack_midiseq */, - 4BFA5E980DEC4D9C00FA4CDB /* testSem */, - 4BFA828C0DF6A9E40087B4E1 /* jack_midiseq */, - 4BFA829F0DF6A9E40087B4E1 /* jack_midiseq */, - 4BFA82AB0DF6A9E40087B4E1 /* jack_midiseq */, - 4BFA82B70DF6A9E40087B4E1 /* jack_midiseq */, - 4BFA82C30DF6A9E40087B4E1 /* jack_midiseq */, - 4BFA82CF0DF6A9E40087B4E1 /* jack_midiseq */, - 4B19B3000E23620F00DD4A82 /* netmanager.so */, - 4B5E08D50E5B66EE00BEE4E0 /* netmanager.so */, + 4BA7FEC30D8E76270017FF73 /* jack_server_control */, + 4B363DD80DEB02F6001F72D9 /* jack_alias */, + 4B363E1A0DEB03C5001F72D9 /* jack_evmon */, + 4B363E4E0DEB0775001F72D9 /* jack_bufsize */, + 4B363EE90DEB091C001F72D9 /* jack_rec */, + 4B363F1E0DEB0A6A001F72D9 /* jack_monitor_client */, + 4B363F350DEB0BD1001F72D9 /* jack_showtime */, + 4B363F720DEB0D4E001F72D9 /* jack_impulse_grabber */, + 4BFA5E980DEC4D9C00FA4CDB /* testMutex */, + 4BFA828C0DF6A9E40087B4E1 /* jack_evmon */, + 4BFA829F0DF6A9E40087B4E1 /* jack_bufsize */, + 4BFA82AB0DF6A9E40087B4E1 /* jack_rec */, + 4BFA82B70DF6A9E40087B4E1 /* jack_monitor_client */, + 4BFA82C30DF6A9E40087B4E1 /* jack_showtime */, + 4BFA82CF0DF6A9E40087B4E1 /* jack_impulse_grabber */, + 4B19B3000E23620F00DD4A82 /* audioadapter.so */, + 4B5E08D50E5B66EE00BEE4E0 /* netadapter.so */, ); name = Products; sourceTree = ""; @@ -2367,9 +2372,10 @@ 4BA3874007947A46008D8992 /* Synchro */ = { isa = PBXGroup; children = ( + 4BECB2F30F4451C10091B70A /* JackProcessSync.cpp */, + 4BECB2F40F4451C10091B70A /* JackProcessSync.h */, 4BC3B6B70E703BAA0066E42F /* JackPosixSemaphore.cpp */, 4BC3B6B80E703BAA0066E42F /* JackPosixSemaphore.h */, - 4BC3B6AA0E703B690066E42F /* JackProcessSync.cpp */, 4BD561C708EEB910006BBC2A /* JackSynchro.h */, 4BF8D1A70834EEB400C94B91 /* JackActivationCount.h */, 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */, @@ -2677,6 +2683,7 @@ 4B9A26050DBF8584006E9FBC /* jslist.h in Headers */, 4B4F9C910DC20C0400706CB0 /* JackMessageBuffer.h in Headers */, 4B93F19E0E87998400E4ECCD /* JackPosixThread.h in Headers */, + 4BECB2FA0F4451C10091B70A /* JackProcessSync.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2740,6 +2747,7 @@ 4B4E9AFD0E5F1090000A3278 /* JackControlAPI.h in Headers */, 4B93F19A0E87992200E4ECCD /* JackPosixThread.h in Headers */, 4BBAE4120F42FA6100B8BD3F /* JackEngineProfiling.h in Headers */, + 4BECB2FC0F4451C10091B70A /* JackProcessSync.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3038,6 +3046,7 @@ 4B4F9C8F0DC20C0400706CB0 /* JackMessageBuffer.h in Headers */, 4BB9D4B30E2610B300351653 /* JackTransportEngine.h in Headers */, 4BC3B6A50E703B2E0066E42F /* JackPosixThread.h in Headers */, + 4BECB2F80F4451C10091B70A /* JackProcessSync.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3106,6 +3115,7 @@ 4BC3B6A70E703B2E0066E42F /* JackPosixThread.h in Headers */, 4BF2841B0F31B4BC00B05BE3 /* JackArgParser.h in Headers */, 4BBAE4100F42FA6100B8BD3F /* JackEngineProfiling.h in Headers */, + 4BECB2F60F4451C10091B70A /* JackProcessSync.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3392,7 +3402,7 @@ ); name = audioadapter; productName = jack_coreaudio; - productReference = 4B19B3000E23620F00DD4A82 /* netmanager.so */; + productReference = 4B19B3000E23620F00DD4A82 /* audioadapter.so */; productType = "com.apple.product-type.library.dynamic"; }; 4B35C41B0D4731D1000DE7AE /* jackdmp framework 64bits */ = { @@ -3449,7 +3459,7 @@ ); name = "Jackservermp.framework 64 bits"; productName = Jack; - productReference = 4B35C4FC0D4731D1000DE7AE /* Jackdmp.framework */; + productReference = 4B35C4FC0D4731D1000DE7AE /* Jackservermp.framework */; productType = "com.apple.product-type.framework"; }; 4B35C50A0D4731D1000DE7AE /* jack_midiseq 64 bits */ = { @@ -3898,7 +3908,7 @@ name = "jack_alias Universal"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4B363DD80DEB02F6001F72D9 /* jack_midiseq */; + productReference = 4B363DD80DEB02F6001F72D9 /* jack_alias */; productType = "com.apple.product-type.tool"; }; 4B363E100DEB03C5001F72D9 /* jack_evmon Universal */ = { @@ -3917,7 +3927,7 @@ name = "jack_evmon Universal"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4B363E1A0DEB03C5001F72D9 /* jack_midiseq */; + productReference = 4B363E1A0DEB03C5001F72D9 /* jack_evmon */; productType = "com.apple.product-type.tool"; }; 4B363E440DEB0775001F72D9 /* jack_bufsize Universal */ = { @@ -3936,7 +3946,7 @@ name = "jack_bufsize Universal"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4B363E4E0DEB0775001F72D9 /* jack_midiseq */; + productReference = 4B363E4E0DEB0775001F72D9 /* jack_bufsize */; productType = "com.apple.product-type.tool"; }; 4B363EDF0DEB091C001F72D9 /* jack_rec Universal */ = { @@ -3955,7 +3965,7 @@ name = "jack_rec Universal"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4B363EE90DEB091C001F72D9 /* jack_midiseq */; + productReference = 4B363EE90DEB091C001F72D9 /* jack_rec */; productType = "com.apple.product-type.tool"; }; 4B363F140DEB0A6A001F72D9 /* jack_monitor_client Universal */ = { @@ -3974,7 +3984,7 @@ name = "jack_monitor_client Universal"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4B363F1E0DEB0A6A001F72D9 /* jack_midiseq */; + productReference = 4B363F1E0DEB0A6A001F72D9 /* jack_monitor_client */; productType = "com.apple.product-type.tool"; }; 4B363F2B0DEB0BD1001F72D9 /* jack_showtime Universal */ = { @@ -3993,7 +4003,7 @@ name = "jack_showtime Universal"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4B363F350DEB0BD1001F72D9 /* jack_midiseq */; + productReference = 4B363F350DEB0BD1001F72D9 /* jack_showtime */; productType = "com.apple.product-type.tool"; }; 4B363F680DEB0D4E001F72D9 /* jack_impulse_grabber Universal */ = { @@ -4012,7 +4022,7 @@ name = "jack_impulse_grabber Universal"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4B363F720DEB0D4E001F72D9 /* jack_midiseq */; + productReference = 4B363F720DEB0D4E001F72D9 /* jack_impulse_grabber */; productType = "com.apple.product-type.tool"; }; 4B5A1BB10CD1CB9E0005BF74 /* jack_midiseq Universal */ = { @@ -4067,7 +4077,7 @@ ); name = netadapter; productName = jack_coreaudio; - productReference = 4B5E08D50E5B66EE00BEE4E0 /* netmanager.so */; + productReference = 4B5E08D50E5B66EE00BEE4E0 /* netadapter.so */; productType = "com.apple.product-type.library.dynamic"; }; 4B699BA7097D421600A18468 /* jackdmp framework Universal */ = { @@ -4461,7 +4471,7 @@ name = "jack_server_control Universal"; productInstallPath = /usr/local/bin; productName = jack_lsp; - productReference = 4BA7FEC30D8E76270017FF73 /* jack_lsp */; + productReference = 4BA7FEC30D8E76270017FF73 /* jack_server_control */; productType = "com.apple.product-type.tool"; }; 4BD623ED0CBCF0F000DE782F /* inprocess */ = { @@ -4535,7 +4545,7 @@ name = "testMutex Universal"; productInstallPath = /usr/local/bin; productName = testSem; - productReference = 4BFA5E980DEC4D9C00FA4CDB /* testSem */; + productReference = 4BFA5E980DEC4D9C00FA4CDB /* testMutex */; productType = "com.apple.product-type.tool"; }; 4BFA82820DF6A9E40087B4E1 /* jack_evmon 64 bits */ = { @@ -4554,7 +4564,7 @@ name = "jack_evmon 64 bits"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4BFA828C0DF6A9E40087B4E1 /* jack_midiseq */; + productReference = 4BFA828C0DF6A9E40087B4E1 /* jack_evmon */; productType = "com.apple.product-type.tool"; }; 4BFA82950DF6A9E40087B4E1 /* jack_bufsize 64 bits */ = { @@ -4573,7 +4583,7 @@ name = "jack_bufsize 64 bits"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4BFA829F0DF6A9E40087B4E1 /* jack_midiseq */; + productReference = 4BFA829F0DF6A9E40087B4E1 /* jack_bufsize */; productType = "com.apple.product-type.tool"; }; 4BFA82A10DF6A9E40087B4E1 /* jack_rec 64 bits */ = { @@ -4592,7 +4602,7 @@ name = "jack_rec 64 bits"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4BFA82AB0DF6A9E40087B4E1 /* jack_midiseq */; + productReference = 4BFA82AB0DF6A9E40087B4E1 /* jack_rec */; productType = "com.apple.product-type.tool"; }; 4BFA82AD0DF6A9E40087B4E1 /* jack_monitor_client 64 bits */ = { @@ -4611,7 +4621,7 @@ name = "jack_monitor_client 64 bits"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4BFA82B70DF6A9E40087B4E1 /* jack_midiseq */; + productReference = 4BFA82B70DF6A9E40087B4E1 /* jack_monitor_client */; productType = "com.apple.product-type.tool"; }; 4BFA82B90DF6A9E40087B4E1 /* jack_showtime 64 bits */ = { @@ -4630,7 +4640,7 @@ name = "jack_showtime 64 bits"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4BFA82C30DF6A9E40087B4E1 /* jack_midiseq */; + productReference = 4BFA82C30DF6A9E40087B4E1 /* jack_showtime */; productType = "com.apple.product-type.tool"; }; 4BFA82C50DF6A9E40087B4E1 /* jack_impulse_grabber 64 bits */ = { @@ -4649,7 +4659,7 @@ name = "jack_impulse_grabber 64 bits"; productInstallPath = /usr/local/bin; productName = jack_metro; - productReference = 4BFA82CF0DF6A9E40087B4E1 /* jack_midiseq */; + productReference = 4BFA82CF0DF6A9E40087B4E1 /* jack_impulse_grabber */; productType = "com.apple.product-type.tool"; }; 4BFA99980AAAF3B0009E916C /* jdelay Universal */ = { @@ -5331,8 +5341,8 @@ 4B4F9C900DC20C0400706CB0 /* JackMessageBuffer.cpp in Sources */, 4B93F19C0E87998200E4ECCD /* JackPosixServerLaunch.cpp in Sources */, 4B93F19D0E87998400E4ECCD /* JackPosixThread.cpp in Sources */, - 4B93F19F0E87998600E4ECCD /* JackProcessSync.cpp in Sources */, 4B93F1C00E87A35400E4ECCD /* JackMachTime.c in Sources */, + 4BECB2F90F4451C10091B70A /* JackProcessSync.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5386,9 +5396,9 @@ 4B4CA9780E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp in Sources */, 4B4E9AFC0E5F1090000A3278 /* JackControlAPI.cpp in Sources */, 4B93F1990E87992100E4ECCD /* JackPosixThread.cpp in Sources */, - 4B93F19B0E87992300E4ECCD /* JackProcessSync.cpp in Sources */, 4B93F22B0E87A72500E4ECCD /* JackMachTime.c in Sources */, 4BBAE4130F42FA6100B8BD3F /* JackEngineProfiling.cpp in Sources */, + 4BECB2FB0F4451C10091B70A /* JackProcessSync.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5707,9 +5717,9 @@ 4BB9D4B40E2610B400351653 /* JackTransportEngine.cpp in Sources */, 4BB9D4E40E26112900351653 /* JackEngineControl.cpp in Sources */, 4BC3B6A40E703B2E0066E42F /* JackPosixThread.cpp in Sources */, - 4BC3B6AB0E703B690066E42F /* JackProcessSync.cpp in Sources */, 4BF5FBBC0E878B9C003D2374 /* JackPosixServerLaunch.cpp in Sources */, 4BF5FBCB0E878D24003D2374 /* JackMachTime.c in Sources */, + 4BECB2F70F4451C10091B70A /* JackProcessSync.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5764,10 +5774,10 @@ 4B4CA9760E02CF9600F4BFDA /* JackRestartThreadedDriver.cpp in Sources */, 4B4E9AFA0E5F1090000A3278 /* JackControlAPI.cpp in Sources */, 4BC3B6A60E703B2E0066E42F /* JackPosixThread.cpp in Sources */, - 4BC3B6AC0E703B690066E42F /* JackProcessSync.cpp in Sources */, 4BF5FBCA0E878D24003D2374 /* JackMachTime.c in Sources */, 4BF2841A0F31B4BC00B05BE3 /* JackArgParser.cpp in Sources */, 4BBAE4110F42FA6100B8BD3F /* JackEngineProfiling.cpp in Sources */, + 4BECB2F50F4451C10091B70A /* JackProcessSync.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/posix/JackPosixMutex.h b/posix/JackPosixMutex.h index c56261cb..8fc6ea06 100644 --- a/posix/JackPosixMutex.h +++ b/posix/JackPosixMutex.h @@ -23,7 +23,7 @@ #define __JackPosixMutex__ #include - +#include #include #include "JackError.h" @@ -36,7 +36,7 @@ namespace Jack class JackPosixMutex { - private: + protected: pthread_mutex_t fMutex; @@ -56,7 +56,8 @@ class JackPosixMutex res = pthread_mutexattr_destroy(&mutex_attr); assert(res == 0); } - ~JackPosixMutex() + + virtual ~JackPosixMutex() { pthread_mutex_destroy(&fMutex); } diff --git a/posix/JackPosixThread.cpp b/posix/JackPosixThread.cpp index 807b0868..a1ac219e 100644 --- a/posix/JackPosixThread.cpp +++ b/posix/JackPosixThread.cpp @@ -144,6 +144,7 @@ int JackPosixThread::StartImp(pthread_t* thread, int priority, int realtime, voi return -1; } + pthread_attr_destroy(&attributes); return 0; } diff --git a/posix/JackProcessSync.cpp b/posix/JackProcessSync.cpp index 0e122096..b29ab138 100644 --- a/posix/JackProcessSync.cpp +++ b/posix/JackProcessSync.cpp @@ -23,6 +23,68 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. namespace Jack { +void JackProcessSync::Signal() +{ + int res = pthread_cond_signal(&fCond); + if (res != 0) + jack_error("pthread_cond_signal error err = %s", strerror(res)); +} + +void JackProcessSync::LockedSignal() +{ + int res; + res = pthread_mutex_lock(&fMutex); + if (res != 0) + jack_error("pthread_mutex_lock error err = %s", strerror(res)); + res = pthread_cond_signal(&fCond); + if (res != 0) + jack_error("pthread_cond_signal error err = %s", strerror(res)); + res = pthread_mutex_unlock(&fMutex); + if (res != 0) + jack_error("pthread_mutex_unlock error err = %s", strerror(res)); +} + +void JackProcessSync::SignalAll() +{ + int res = pthread_cond_broadcast(&fCond); + if (res != 0) + jack_error("pthread_cond_broadcast error err = %s", strerror(res)); +} + +void JackProcessSync::LockedSignalAll() +{ + int res; + res = pthread_mutex_lock(&fMutex); + if (res != 0) + jack_error("pthread_mutex_lock error err = %s", strerror(res)); + res = pthread_cond_broadcast(&fCond); + if (res != 0) + jack_error("pthread_cond_broadcast error err = %s", strerror(res)); + res = pthread_mutex_unlock(&fMutex); + if (res != 0) + jack_error("pthread_mutex_unlock error err = %s", strerror(res)); +} + +void JackProcessSync::Wait() +{ + int res; + if ((res = pthread_cond_wait(&fCond, &fMutex)) != 0) + jack_error("pthread_cond_wait error err = %s", strerror(errno)); + } + +void JackProcessSync::LockedWait() +{ + int res; + res = pthread_mutex_lock(&fMutex); + if (res != 0) + jack_error("pthread_mutex_lock error err = %s", strerror(res)); + if ((res = pthread_cond_wait(&fCond, &fMutex)) != 0) + jack_error("pthread_cond_wait error err = %s", strerror(errno)); + res = pthread_mutex_unlock(&fMutex); + if (res != 0) + jack_error("pthread_mutex_unlock error err = %s", strerror(res)); +} + bool JackProcessSync::TimedWait(long usec) { struct timeval T0, T1; @@ -30,7 +92,6 @@ bool JackProcessSync::TimedWait(long usec) struct timeval now; int res; - pthread_mutex_lock(&fLock); jack_log("JackProcessSync::TimedWait time out = %ld", usec); gettimeofday(&T0, 0); @@ -38,38 +99,49 @@ bool JackProcessSync::TimedWait(long usec) unsigned int next_date_usec = now.tv_usec + usec; time.tv_sec = now.tv_sec + (next_date_usec / 1000000); time.tv_nsec = (next_date_usec % 1000000) * 1000; - res = pthread_cond_timedwait(&fCond, &fLock, &time); + res = pthread_cond_timedwait(&fCond, &fMutex, &time); if (res != 0) jack_error("pthread_cond_timedwait error usec = %ld err = %s", usec, strerror(res)); gettimeofday(&T1, 0); - pthread_mutex_unlock(&fLock); jack_log("JackProcessSync::TimedWait finished delta = %5.1lf", (1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec)); return (res == 0); } -void JackProcessSync::Wait() +bool JackProcessSync::LockedTimedWait(long usec) { + struct timeval T0, T1; + timespec time; + struct timeval now; int res; - pthread_mutex_lock(&fLock); - //jack_log("JackProcessSync::Wait..."); - if ((res = pthread_cond_wait(&fCond, &fLock)) != 0) - jack_error("pthread_cond_wait error err = %s", strerror(errno)); - pthread_mutex_unlock(&fLock); - //jack_log("JackProcessSync::Wait finished"); -} -bool JackInterProcessSync::TimedWait(long usec) -{ - struct timeval T0, T1; - //jack_log("JackInterProcessSync::TimedWait..."); + res = pthread_mutex_lock(&fMutex); + if (res != 0) + jack_error("pthread_mutex_lock error err = %s", usec, strerror(res)); + + jack_log("JackProcessSync::TimedWait time out = %ld", usec); gettimeofday(&T0, 0); - bool res = fSynchro->TimedWait(usec); + + gettimeofday(&now, 0); + unsigned int next_date_usec = now.tv_usec + usec; + time.tv_sec = now.tv_sec + (next_date_usec / 1000000); + time.tv_nsec = (next_date_usec % 1000000) * 1000; + res = pthread_cond_timedwait(&fCond, &fMutex, &time); + if (res != 0) + jack_error("pthread_cond_timedwait error usec = %ld err = %s", usec, strerror(res)); + gettimeofday(&T1, 0); - //jack_log("JackInterProcessSync::TimedWait finished delta = %5.1lf", (1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec)); - return res; + + pthread_mutex_unlock(&fMutex); + if (res != 0) + jack_error("pthread_mutex_unlock error err = %s", usec, strerror(res)); + + jack_log("JackProcessSync::TimedWait finished delta = %5.1lf", + (1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec)); + return (res == 0); } + } // end of namespace diff --git a/posix/JackProcessSync.h b/posix/JackProcessSync.h index e689831b..4cf82850 100644 --- a/posix/JackProcessSync.h +++ b/posix/JackProcessSync.h @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __JackProcessSync__ #include "JackPlatformPlug.h" -#include +#include "JackPosixMutex.h" #include #include @@ -32,110 +32,39 @@ namespace Jack \brief A synchronization primitive built using a condition variable. */ -class JackProcessSync +class JackProcessSync : public JackPosixMutex { private: - pthread_mutex_t fLock; // Mutex pthread_cond_t fCond; // Condition variable public: - JackProcessSync() + JackProcessSync():JackPosixMutex() { - pthread_mutex_init(&fLock, NULL); pthread_cond_init(&fCond, NULL); } ~JackProcessSync() { - pthread_mutex_destroy(&fLock); pthread_cond_destroy(&fCond); } - bool Allocate(const char* name) - { - return true; - } - - bool Connect(const char* name) - { - return true; - } - - void Destroy() - {} - bool TimedWait(long usec); - - void Wait(); + bool LockedTimedWait(long usec); - void Signal() - { - pthread_mutex_lock(&fLock); - pthread_cond_signal(&fCond); - pthread_mutex_unlock(&fLock); - } - - void SignalAll() - { - //pthread_mutex_lock(&fLock); - pthread_cond_broadcast(&fCond); - //pthread_mutex_unlock(&fLock); - } - -}; - -/*! -\brief A synchronization primitive built using an inter-process synchronization object. -*/ - -class JackInterProcessSync -{ - - private: - - JackSynchro* fSynchro; - - public: - - JackInterProcessSync(JackSynchro* synchro): fSynchro(synchro) - {} - ~JackInterProcessSync() - { - delete fSynchro; - } - - bool Allocate(const char* name) - { - return fSynchro->Allocate(name, "", 0); - } - - void Destroy() - { - fSynchro->Destroy(); - } - - bool Connect(const char* name) - { - return fSynchro->Connect(name, ""); - } - - bool TimedWait(long usec); - - void Wait() - { - fSynchro->Wait(); - } - - void SignalAll() - { - fSynchro->SignalAll(); - } + void Wait(); + void LockedWait(); + + void Signal(); + void LockedSignal(); + + void SignalAll(); + void LockedSignalAll(); + }; - } // end of namespace #endif diff --git a/windows/JackWinMutex.h b/windows/JackWinMutex.h index 777868f8..422752b6 100644 --- a/windows/JackWinMutex.h +++ b/windows/JackWinMutex.h @@ -32,7 +32,7 @@ namespace Jack class JackWinMutex { - private: + protected: HANDLE fMutex; @@ -43,7 +43,8 @@ class JackWinMutex // In recursive mode by default fMutex = (HANDLE)CreateMutex(0, FALSE, 0); } - ~JackWinMutex() + + virtual ~JackWinMutex() { CloseHandle(fMutex); } diff --git a/windows/JackWinProcessSync.cpp b/windows/JackWinProcessSync.cpp index 2b70b378..0254708b 100644 --- a/windows/JackWinProcessSync.cpp +++ b/windows/JackWinProcessSync.cpp @@ -23,17 +23,67 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. namespace Jack { -bool JackWinProcessSync::TimedWait(long usec) +void JackWinProcessSync::Signal() { - DWORD res = WaitForSingleObject(fEvent, usec / 1000); - return (res == WAIT_OBJECT_0); + SetEvent(fEvent); } - + +void JackWinProcessSync::LockedSignal() +{ + WaitForSingleObject(fMutex, INFINITE); + SetEvent(fEvent); + ReleaseMutex(fMutex); +} + +void JackWinProcessSync::SignalAll() +{ + SetEvent(fEvent); +} + +void JackWinProcessSync::SignalAll() +{ + WaitForSingleObject(fMutex, INFINITE); + SetEvent(fEvent); + ReleaseMutex(fMutex); +} + void JackWinProcessSync::Wait() { WaitForSingleObject(fEvent, INFINITE); } + +void JackWinProcessSync::LockedWait() +{ + WaitForSingleObject(fMutex, INFINITE); + ReleaseMutex(fMutex); + HANDLE handles[] = { fMutex, fEvent }; + DWORD res = WaitForMultipleObjects(2, handles, true, INFINITE); + if (res != WAIT_OBJECT_0) && ( res != WAIT_TIMEOUT)) + jack_error("LockedWait error err = %d", GetLastError()); + ResetEvent(fEvent); +} + +bool JackWinProcessSync::TimedWait(long usec) +{ + DWORD res = WaitForSingleObject(fEvent, usec / 1000); + if (res != WAIT_OBJECT_0) && (res != WAIT_TIMEOUT)) + jack_error("TimedWait error err = %d", GetLastError()); + return (res == WAIT_OBJECT_0); +} + +bool JackWinProcessSync::LockedTimedWait(long usec) +{ + WaitForSingleObject(fMutex, INFINITE); + ReleaseMutex(fMutex); + HANDLE handles[] = { fMutex, fEvent }; + DWORD res = WaitForMultipleObjects(2, handles, true, usec / 1000); + if (res != WAIT_OBJECT_0) && (res != WAIT_TIMEOUT)) + jack_error("TimedWait error err = %d", GetLastError()); + ResetEvent(fEvent); + return (res == WAIT_OBJECT_0); +} + } // end of namespace diff --git a/windows/JackWinProcessSync.h b/windows/JackWinProcessSync.h index 1c1f8071..33a340c9 100644 --- a/windows/JackWinProcessSync.h +++ b/windows/JackWinProcessSync.h @@ -20,7 +20,7 @@ This program is free software; you can redistribute it and/or modify #ifndef __JackWinProcessSync__ #define __JackWinProcessSync__ -#include +#include "JackWinMutex.h" namespace Jack { @@ -29,7 +29,7 @@ namespace Jack \brief A synchronization primitive built using a condition variable. */ -class JackWinProcessSync +class JackWinProcessSync : public JackWinMutex { private: @@ -38,7 +38,7 @@ class JackWinProcessSync public: - JackWinProcessSync() + JackWinProcessSync():JackWinMutex() { fEvent = (HANDLE)CreateEvent(NULL, FALSE, FALSE, NULL); } @@ -46,34 +46,18 @@ class JackWinProcessSync { CloseHandle(fEvent); } - - bool Allocate(const char* name) - { - return true; - } - - bool Connect(const char* name) - { - return true; - } - - void Destroy() - {} - + bool TimedWait(long usec); - - void Wait(); - - void Signal() - { - SetEvent(fEvent); - } + bool LockedTimedWait(long usec); - void SignalAll() - { - SetEvent(fEvent); - } - + void Wait(); + void LockedWait(); + + void Signal(); + void LockedSignal(); + + void SignalAll(); + void LockedSignalAll(); }; } // end of namespace