diff --git a/common/JackMessageBuffer.cpp b/common/JackMessageBuffer.cpp index 168fabe8..ca013df3 100644 --- a/common/JackMessageBuffer.cpp +++ b/common/JackMessageBuffer.cpp @@ -22,6 +22,7 @@ #include "JackMessageBuffer.h" #include "JackGlobals.h" #include "JackError.h" +#include "JackTime.h" namespace Jack { @@ -167,17 +168,24 @@ int JackMessageBuffer::SetInitCallback(JackThreadInitCallback callback, void *ar /* set up the callback */ fInitArg = arg; fInit = callback; - /* wake msg buffer thread */ - fGuard.Signal(); - /* wait for it to be done */ - fGuard.Wait(); + + int count = 0; + while (fInit && ++count < 1000) { + /* wake msg buffer thread */ + fGuard.Signal(); + JackSleep(1000); + } + //fGuard.Wait(); + /* and we're done */ fGuard.Unlock(); + if (count == 1000) goto error; return 0; - } else { - jack_error("JackMessageBuffer::SetInitCallback : callback cannot be executed"); - return -1; } + +error: + jack_error("JackMessageBuffer::SetInitCallback : callback cannot be executed"); + return -1; } }; diff --git a/common/wscript b/common/wscript index 7a79a8a8..545dd3c8 100644 --- a/common/wscript +++ b/common/wscript @@ -206,6 +206,7 @@ def build(bld): 'JackLibSampleRateResampler.cpp', 'JackResampler.cpp', 'JackGlobals.cpp', + 'JackPosixMutex.cpp', 'ringbuffer.c'] if bld.env['IS_LINUX']: diff --git a/macosx/Jackdmp.xcodeproj/project.pbxproj b/macosx/Jackdmp.xcodeproj/project.pbxproj index b8fce410..2449f8e5 100644 --- a/macosx/Jackdmp.xcodeproj/project.pbxproj +++ b/macosx/Jackdmp.xcodeproj/project.pbxproj @@ -985,6 +985,8 @@ 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 */; }; + 4BF1007C15135D8200B88F80 /* JackPosixMutex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B327BA614B4B50400976483 /* JackPosixMutex.cpp */; }; + 4BF1007D15135D8800B88F80 /* JackPosixMutex.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BB4214814D2C0A700A1CAE1 /* JackPosixMutex.h */; }; 4BF2841A0F31B4BC00B05BE3 /* JackArgParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF284160F31B4BC00B05BE3 /* JackArgParser.cpp */; }; 4BF2841B0F31B4BC00B05BE3 /* JackArgParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF284170F31B4BC00B05BE3 /* JackArgParser.h */; }; 4BF3391A0F8B86DC0080FB5B /* JackCoreMidiDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF339140F8B86DC0080FB5B /* JackCoreMidiDriver.h */; }; @@ -4310,6 +4312,7 @@ 4B86934E1371DEBD00D2D11B /* JackLibSampleRateResampler.h in Headers */, 4B49D44E14865F22003390F8 /* net.h in Headers */, 4B49D44F14865F22003390F8 /* session.h in Headers */, + 4BF1007D15135D8800B88F80 /* JackPosixMutex.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -7831,6 +7834,7 @@ 4B86932C1371DD9B00D2D11B /* ringbuffer.c in Sources */, 4B86934D1371DEBA00D2D11B /* JackLibSampleRateResampler.cpp in Sources */, 4B327BD614B4B6E700976483 /* JackException.cpp in Sources */, + 4BF1007C15135D8200B88F80 /* JackPosixMutex.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/windows/JackWinProcessSync.h b/windows/JackWinProcessSync.h index 1891097c..c700d33f 100644 --- a/windows/JackWinProcessSync.h +++ b/windows/JackWinProcessSync.h @@ -70,7 +70,7 @@ class JackWinProcessSync : public JackWinMutex void LockedSignalAll(); }; -#ifdef __MINGW64__ +#ifdef __WIN64__ class JackWinCondVar {