git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2429 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.90
| @@ -20,6 +20,10 @@ Fernando Lopez-Lezcano | |||
| Jackdmp changes log | |||
| --------------------------- | |||
| 2008-06-02 Stephane Letz <letz@grame.fr> | |||
| * Tim Blechmann patch to remove unnecessary virtual methods : choice of the appropriate platform version is now done at compilation time. | |||
| 2008-06-02 Stephane Letz <letz@grame.fr> | |||
| * Cleanup and correct wscript for example-clients. | |||
| @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #ifndef __JackActivationCount__ | |||
| #define __JackActivationCount__ | |||
| #include "JackSynchro.h" | |||
| #include "JackPlatformSynchro.h" | |||
| #include "JackTime.h" | |||
| #include "JackTypes.h" | |||
| @@ -40,7 +40,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| namespace Jack | |||
| { | |||
| JackAudioDriver::JackAudioDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro** table) | |||
| JackAudioDriver::JackAudioDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro* table) | |||
| : JackDriver(name, alias, engine, table), | |||
| fCaptureChannels(0), | |||
| fPlaybackChannels(0), | |||
| @@ -57,7 +57,7 @@ class EXPORT JackAudioDriver : public JackDriver | |||
| public: | |||
| JackAudioDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro** table); | |||
| JackAudioDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro* table); | |||
| virtual ~JackAudioDriver(); | |||
| virtual int Process(); | |||
| @@ -31,6 +31,8 @@ class JackServer; | |||
| struct JackEngineControl; | |||
| class JackGraphManager; | |||
| namespace detail | |||
| { | |||
| /*! | |||
| \brief Inter process channel for server/client bidirectionnal communication : request and (receiving) notifications. | |||
| */ | |||
| @@ -120,91 +122,9 @@ class JackClientChannelInterface | |||
| virtual void InternalClientUnload(int refnum, int int_ref, int* status, int* result) | |||
| {} | |||
| }; | |||
| /*! | |||
| \brief Inter process channel for server to client notifications. | |||
| */ | |||
| class JackNotifyChannelInterface | |||
| { | |||
| public: | |||
| JackNotifyChannelInterface() | |||
| {} | |||
| virtual ~JackNotifyChannelInterface() | |||
| {} | |||
| // Open the Server/Client connection | |||
| virtual int Open(const char* name) | |||
| { | |||
| return 0; | |||
| } | |||
| // Close the Server/Client connection | |||
| virtual void Close() | |||
| {} | |||
| /* | |||
| The "sync" parameter allows to choose between "synchronous" and "asynchronous" notification | |||
| */ | |||
| virtual void ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2, int* result) | |||
| {} | |||
| }; | |||
| /*! | |||
| \brief Entry point channel for client/server communication. | |||
| */ | |||
| class JackServerChannelInterface | |||
| { | |||
| public: | |||
| JackServerChannelInterface() | |||
| {} | |||
| virtual ~JackServerChannelInterface() | |||
| {} | |||
| // Open the Server/Client connection | |||
| virtual int Open(const char* server_name, JackServer* server) | |||
| { | |||
| return 0; | |||
| } | |||
| // Close the Server/Client connection | |||
| virtual void Close() | |||
| {} | |||
| }; | |||
| /*! | |||
| \brief Channel for server RT thread to request server thread communication. | |||
| */ | |||
| class JackServerNotifyChannelInterface | |||
| { | |||
| public: | |||
| JackServerNotifyChannelInterface() | |||
| {} | |||
| virtual ~JackServerNotifyChannelInterface() | |||
| {} | |||
| // Open the Server RT/Server connection | |||
| virtual int Open(const char* server_name) | |||
| { | |||
| return 0; | |||
| } | |||
| // Close the Server RT/Server connection | |||
| virtual void Close() | |||
| {} | |||
| virtual void Notify(int refnum, int notify, int value) | |||
| {} | |||
| }; | |||
| } | |||
| } // end of namespace | |||
| @@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #include <math.h> | |||
| #include <string> | |||
| #include <algorithm> | |||
| #include "JackPlatformThread.h" | |||
| using namespace std; | |||
| @@ -41,12 +42,11 @@ namespace Jack | |||
| #define IsRealTime() ((fProcess != NULL) | (fThreadFun != NULL) | (fSync != NULL) | (fTimebase != NULL)) | |||
| JackClient::JackClient() | |||
| JackClient::JackClient():fThread(this) | |||
| {} | |||
| JackClient::JackClient(JackSynchro** table) | |||
| JackClient::JackClient(JackSynchro* table):fThread(this) | |||
| { | |||
| fThread = JackGlobals::MakeThread(this); | |||
| fSynchroTable = table; | |||
| fProcess = NULL; | |||
| fGraphOrder = NULL; | |||
| @@ -78,7 +78,6 @@ JackClient::JackClient(JackSynchro** table) | |||
| JackClient::~JackClient() | |||
| { | |||
| delete fThread; | |||
| } | |||
| int JackClient::Close() | |||
| @@ -89,7 +88,7 @@ int JackClient::Close() | |||
| fChannel->Stop(); // Channels is stopped first to avoid receiving notifications while closing | |||
| fChannel->ClientClose(GetClientControl()->fRefNum, &result); | |||
| fChannel->Close(); | |||
| fSynchroTable[GetClientControl()->fRefNum]->Disconnect(); | |||
| fSynchroTable[GetClientControl()->fRefNum].Disconnect(); | |||
| return result; | |||
| } | |||
| @@ -100,7 +99,7 @@ bool JackClient::IsActive() | |||
| pthread_t JackClient::GetThreadID() | |||
| { | |||
| return fThread->GetThreadID(); | |||
| return fThread.GetThreadID(); | |||
| } | |||
| /*! | |||
| @@ -112,14 +111,14 @@ void JackClient::SetupDriverSync(bool freewheel) | |||
| { | |||
| if (!freewheel && !GetEngineControl()->fSyncMode) { | |||
| jack_log("JackClient::SetupDriverSync driver sem in flush mode"); | |||
| fSynchroTable[AUDIO_DRIVER_REFNUM]->SetFlush(true); | |||
| fSynchroTable[FREEWHEEL_DRIVER_REFNUM]->SetFlush(true); | |||
| fSynchroTable[LOOPBACK_DRIVER_REFNUM]->SetFlush(true); | |||
| fSynchroTable[AUDIO_DRIVER_REFNUM].SetFlush(true); | |||
| fSynchroTable[FREEWHEEL_DRIVER_REFNUM].SetFlush(true); | |||
| fSynchroTable[LOOPBACK_DRIVER_REFNUM].SetFlush(true); | |||
| } else { | |||
| jack_log("JackClient::SetupDriverSync driver sem in normal mode"); | |||
| fSynchroTable[AUDIO_DRIVER_REFNUM]->SetFlush(false); | |||
| fSynchroTable[FREEWHEEL_DRIVER_REFNUM]->SetFlush(false); | |||
| fSynchroTable[LOOPBACK_DRIVER_REFNUM]->SetFlush(false); | |||
| fSynchroTable[AUDIO_DRIVER_REFNUM].SetFlush(false); | |||
| fSynchroTable[FREEWHEEL_DRIVER_REFNUM].SetFlush(false); | |||
| fSynchroTable[LOOPBACK_DRIVER_REFNUM].SetFlush(false); | |||
| } | |||
| } | |||
| @@ -188,7 +187,7 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, | |||
| case kStartFreewheelCallback: | |||
| jack_log("JackClient::kStartFreewheel"); | |||
| SetupDriverSync(true); | |||
| fThread->DropRealTime(); | |||
| fThread.DropRealTime(); | |||
| if (fFreewheel) | |||
| fFreewheel(1, fFreewheelArg); | |||
| break; | |||
| @@ -198,7 +197,7 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync, | |||
| SetupDriverSync(false); | |||
| if (fFreewheel) | |||
| fFreewheel(0, fFreewheelArg); | |||
| fThread->AcquireRealTime(); | |||
| fThread.AcquireRealTime(); | |||
| break; | |||
| case kPortRegistrationOnCallback: | |||
| @@ -290,7 +289,7 @@ int JackClient::Deactivate() | |||
| // RT thread is stopped only when needed... | |||
| if (IsRealTime()) | |||
| fThread->Kill(); | |||
| fThread.Kill(); | |||
| return result; | |||
| } | |||
| @@ -318,15 +317,15 @@ int JackClient::StartThread() | |||
| long(int64_t(GetEngineControl()->fConstraint) / 1000.0f)); | |||
| // Will do "something" on OSX only... | |||
| fThread->SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint); | |||
| fThread.SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint); | |||
| if (fThread->Start() < 0) { | |||
| if (fThread.Start() < 0) { | |||
| jack_error("Start thread error"); | |||
| return -1; | |||
| } | |||
| if (GetEngineControl()->fRealTime) { | |||
| if (fThread->AcquireRealTime(GetEngineControl()->fPriority - 1) < 0) { | |||
| if (fThread.AcquireRealTime(GetEngineControl()->fPriority - 1) < 0) { | |||
| jack_error("AcquireRealTime error"); | |||
| } | |||
| } | |||
| @@ -445,7 +444,7 @@ inline int JackClient::End() | |||
| jack_log("JackClient::Execute end name = %s", GetClientControl()->fName); | |||
| // Hum... not sure about this, the following "close" code is called in the RT thread... | |||
| int result; | |||
| fThread->DropRealTime(); | |||
| fThread.DropRealTime(); | |||
| GetClientControl()->fActive = false; | |||
| fChannel->ClientDeactivate(GetClientControl()->fRefNum, &result); | |||
| return 0; | |||
| @@ -456,7 +455,7 @@ inline int JackClient::Error() | |||
| jack_error("JackClient::Execute error name = %s", GetClientControl()->fName); | |||
| // Hum... not sure about this, the following "close" code is called in the RT thread... | |||
| int result; | |||
| fThread->DropRealTime(); | |||
| fThread.DropRealTime(); | |||
| GetClientControl()->fActive = false; | |||
| fChannel->ClientDeactivate(GetClientControl()->fRefNum, &result); | |||
| ShutDown(); | |||
| @@ -30,17 +30,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #include "varargs.h" | |||
| #include <list> | |||
| #include "JackPlatformSynchro.h" | |||
| #include "JackPlatformThread.h" | |||
| #include "JackChannel.h" | |||
| namespace Jack | |||
| { | |||
| class JackClientChannelInterface; | |||
| class JackGraphManager; | |||
| class JackServer; | |||
| class JackEngine; | |||
| class JackSynchro; | |||
| struct JackClientControl; | |||
| struct JackEngineControl; | |||
| class JackSyncInterface; | |||
| typedef void (*JackShutdownCallback)(void *arg); | |||
| @@ -83,9 +84,9 @@ class JackClient : public JackClientInterface, public JackRunnableInterface | |||
| void* fThreadFunArg; | |||
| char fServerName[64]; | |||
| JackThread* fThread; /*! Thread to execute the Process function */ | |||
| JackClientChannelInterface* fChannel; | |||
| JackSynchro** fSynchroTable; | |||
| JackThread fThread; /*! Thread to execute the Process function */ | |||
| detail::JackClientChannelInterface* fChannel; | |||
| JackSynchro* fSynchroTable; | |||
| std::list<jack_port_id_t> fPortList; | |||
| int StartThread(); | |||
| @@ -110,7 +111,7 @@ class JackClient : public JackClientInterface, public JackRunnableInterface | |||
| public: | |||
| JackClient(); | |||
| JackClient(JackSynchro** table); | |||
| JackClient(JackSynchro* table); | |||
| virtual ~JackClient(); | |||
| virtual int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status) = 0; | |||
| @@ -186,7 +187,7 @@ class JackClient : public JackClientInterface, public JackRunnableInterface | |||
| // Each "side" server and client will implement this to get the shared graph manager, engine control and inter-process synchro table. | |||
| extern JackGraphManager* GetGraphManager(); | |||
| extern JackEngineControl* GetEngineControl(); | |||
| extern JackSynchro** GetSynchroTable(); | |||
| extern JackSynchro* GetSynchroTable(); | |||
| } // end of namespace | |||
| @@ -256,10 +256,10 @@ void JackConnectionManager::ResetGraph(JackClientTiming* timing) | |||
| /*! | |||
| \brief Wait on the input synchro. | |||
| */ | |||
| int JackConnectionManager::SuspendRefNum(JackClientControl* control, JackSynchro** table, JackClientTiming* timing, long time_out_usec) | |||
| int JackConnectionManager::SuspendRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing, long time_out_usec) | |||
| { | |||
| bool res; | |||
| if ((res = table[control->fRefNum]->TimedWait(time_out_usec))) { | |||
| if ((res = table[control->fRefNum].TimedWait(time_out_usec))) { | |||
| timing[control->fRefNum].fStatus = Running; | |||
| timing[control->fRefNum].fAwakeAt = GetMicroSeconds(); | |||
| } | |||
| @@ -269,7 +269,7 @@ int JackConnectionManager::SuspendRefNum(JackClientControl* control, JackSynchro | |||
| /*! | |||
| \brief Signal clients connected to the given client. | |||
| */ | |||
| int JackConnectionManager::ResumeRefNum(JackClientControl* control, JackSynchro** table, JackClientTiming* timing) | |||
| int JackConnectionManager::ResumeRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing) | |||
| { | |||
| jack_time_t current_date = GetMicroSeconds(); | |||
| const jack_int_t* outputRef = fConnectionRef.GetItems(control->fRefNum); | |||
| @@ -288,7 +288,7 @@ int JackConnectionManager::ResumeRefNum(JackClientControl* control, JackSynchro* | |||
| timing[i].fStatus = Triggered; | |||
| timing[i].fSignaledAt = current_date; | |||
| if (!fInputCounter[i].Signal(table[i], control)) { | |||
| if (!fInputCounter[i].Signal(table + i, control)) { | |||
| jack_log("JackConnectionManager::ResumeRefNum error: ref = %ld output = %ld ", control->fRefNum, i); | |||
| res = -1; | |||
| } | |||
| @@ -442,8 +442,8 @@ class JackConnectionManager | |||
| // Graph | |||
| void ResetGraph(JackClientTiming* timing); | |||
| int ResumeRefNum(JackClientControl* control, JackSynchro** table, JackClientTiming* timing); | |||
| int SuspendRefNum(JackClientControl* control, JackSynchro** table, JackClientTiming* timing, long time_out_usec); | |||
| int ResumeRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing); | |||
| int SuspendRefNum(JackClientControl* control, JackSynchro* table, JackClientTiming* timing, long time_out_usec); | |||
| }; | |||
| } // end of namespace | |||
| @@ -43,7 +43,7 @@ using namespace std; | |||
| namespace Jack | |||
| { | |||
| JackDriver::JackDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro** table) | |||
| JackDriver::JackDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro* table) | |||
| { | |||
| assert(strlen(name) < JACK_CLIENT_NAME_SIZE); | |||
| fSynchroTable = table; | |||
| @@ -149,10 +149,10 @@ void JackDriver::SetupDriverSync(int ref, bool freewheel) | |||
| { | |||
| if (!freewheel && !fEngineControl->fSyncMode) { | |||
| jack_log("JackDriver::SetupDriverSync driver sem in flush mode"); | |||
| fSynchroTable[ref]->SetFlush(true); | |||
| fSynchroTable[ref].SetFlush(true); | |||
| } else { | |||
| jack_log("JackDriver::SetupDriverSync driver sem in normal mode"); | |||
| fSynchroTable[ref]->SetFlush(false); | |||
| fSynchroTable[ref].SetFlush(false); | |||
| } | |||
| } | |||
| @@ -24,6 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #include "types.h" | |||
| #include "JackClientInterface.h" | |||
| #include "JackConstants.h" | |||
| #include "JackPlatformSynchro.h" | |||
| #include <list> | |||
| namespace Jack | |||
| @@ -31,7 +32,6 @@ namespace Jack | |||
| class JackEngineInterface; | |||
| class JackGraphManager; | |||
| class JackSynchro; | |||
| struct JackEngineControl; | |||
| struct JackClientControl; | |||
| @@ -152,7 +152,7 @@ class EXPORT JackDriver : public JackDriverClient | |||
| float fDelayedUsecs; | |||
| JackEngineInterface* fEngine; | |||
| JackGraphManager* fGraphManager; | |||
| JackSynchro** fSynchroTable; | |||
| JackSynchro* fSynchroTable; | |||
| JackEngineControl* fEngineControl; | |||
| JackClientControl* fClientControl; | |||
| @@ -163,7 +163,7 @@ class EXPORT JackDriver : public JackDriverClient | |||
| public: | |||
| JackDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro** table); | |||
| JackDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro* table); | |||
| JackDriver(); | |||
| virtual ~JackDriver(); | |||
| @@ -45,11 +45,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #endif | |||
| typedef jack_driver_desc_t * (*JackDriverDescFunction) (); | |||
| typedef Jack::JackDriverClientInterface* (*initialize) (Jack::JackEngineInterface*, Jack::JackSynchro**, const JSList *); | |||
| typedef Jack::JackDriverClientInterface* (*initialize) (Jack::JackEngineInterface*, Jack::JackSynchro*, const JSList *); | |||
| typedef struct _jack_driver_info | |||
| { | |||
| Jack::JackDriverClientInterface* (*initialize)(Jack::JackEngineInterface*, Jack::JackSynchro**, const JSList *); | |||
| Jack::JackDriverClientInterface* (*initialize)(Jack::JackEngineInterface*, Jack::JackSynchro*, const JSList *); | |||
| DRIVER_HANDLE handle; | |||
| } | |||
| jack_driver_info_t; | |||
| @@ -138,7 +138,7 @@ extern "C" | |||
| return desc; | |||
| } | |||
| Jack::JackDriverClientInterface* driver_initialize(Jack::JackEngineInterface* engine, Jack::JackSynchro** table, const JSList* params) { | |||
| Jack::JackDriverClientInterface* driver_initialize(Jack::JackEngineInterface* engine, Jack::JackSynchro* table, const JSList* params) { | |||
| jack_nframes_t sample_rate = 48000; | |||
| jack_nframes_t period_size = 1024; | |||
| unsigned int capture_ports = 2; | |||
| @@ -38,7 +38,7 @@ class JackDummyDriver : public JackAudioDriver | |||
| public: | |||
| JackDummyDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro** table, unsigned long wait_time) | |||
| JackDummyDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro* table, unsigned long wait_time) | |||
| : JackAudioDriver(name, alias, engine, table), fWaitTime(wait_time) | |||
| {} | |||
| virtual ~JackDummyDriver() | |||
| @@ -37,21 +37,18 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #include "JackClientControl.h" | |||
| #include "JackGlobals.h" | |||
| #include "JackChannel.h" | |||
| #include "JackSyncInterface.h" | |||
| #include "JackError.h" | |||
| namespace Jack | |||
| { | |||
| JackEngine::JackEngine(JackGraphManager* manager, | |||
| JackSynchro** table, | |||
| JackSynchro* table, | |||
| JackEngineControl* control) | |||
| { | |||
| fGraphManager = manager; | |||
| fSynchroTable = table; | |||
| fEngineControl = control; | |||
| fChannel = JackGlobals::MakeServerNotifyChannel(); | |||
| fSignal = JackGlobals::MakeInterProcessSync(); | |||
| for (int i = 0; i < CLIENT_NUM; i++) | |||
| fClientTable[i] = NULL; | |||
| } | |||
| @@ -59,8 +56,6 @@ JackEngine::JackEngine(JackGraphManager* manager, | |||
| JackEngine::~JackEngine() | |||
| { | |||
| jack_log("JackEngine::~JackEngine"); | |||
| delete fChannel; | |||
| delete fSignal; | |||
| } | |||
| int JackEngine::Open() | |||
| @@ -68,7 +63,7 @@ int JackEngine::Open() | |||
| jack_log("JackEngine::Open"); | |||
| // Open audio thread => request thread communication channel | |||
| if (fChannel->Open(fEngineControl->fServerName) < 0) { | |||
| if (fChannel.Open(fEngineControl->fServerName) < 0) { | |||
| jack_error("Cannot connect to server"); | |||
| return -1; | |||
| } else { | |||
| @@ -79,7 +74,7 @@ int JackEngine::Open() | |||
| int JackEngine::Close() | |||
| { | |||
| jack_log("JackEngine::Close"); | |||
| fChannel->Close(); | |||
| fChannel.Close(); | |||
| // Close (possibly) remaining clients (RT is stopped) | |||
| for (int i = 0; i < CLIENT_NUM; i++) { | |||
| @@ -94,7 +89,7 @@ int JackEngine::Close() | |||
| } | |||
| } | |||
| fSignal->Destroy(); | |||
| fSignal.Destroy(); | |||
| return 0; | |||
| } | |||
| @@ -142,8 +137,8 @@ void JackEngine::ProcessNext(jack_time_t callback_usecs) | |||
| { | |||
| fLastSwitchUsecs = callback_usecs; | |||
| 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 | |||
| fChannel.Notify(ALL_CLIENTS, kGraphOrderCallback, 0); | |||
| fSignal.SignalAll(); // Signal for threads waiting for next cycle | |||
| } | |||
| void JackEngine::ProcessCurrent(jack_time_t callback_usecs) | |||
| @@ -199,12 +194,12 @@ void JackEngine::CheckXRun(jack_time_t callback_usecs) // REVOIR les conditions | |||
| if (status != NotTriggered && status != Finished) { | |||
| jack_error("JackEngine::XRun: client = %s was not run: state = %ld", client->GetClientControl()->fName, status); | |||
| fChannel->Notify(ALL_CLIENTS, kXRunCallback, 0); // Notify all clients | |||
| fChannel.Notify(ALL_CLIENTS, kXRunCallback, 0); // Notify all clients | |||
| } | |||
| if (status == Finished && (long)(finished_date - callback_usecs) > 0) { | |||
| jack_error("JackEngine::XRun: client %s finished after current callback", client->GetClientControl()->fName); | |||
| fChannel->Notify(ALL_CLIENTS, kXRunCallback, 0); // Notify all clients | |||
| fChannel.Notify(ALL_CLIENTS, kXRunCallback, 0); // Notify all clients | |||
| } | |||
| } | |||
| } | |||
| @@ -281,7 +276,7 @@ void JackEngine::NotifyXRun(jack_time_t callback_usecs, float delayed_usecs) | |||
| // Use the audio thread => request thread communication channel | |||
| fEngineControl->ResetFrameTime(callback_usecs); | |||
| fEngineControl->NotifyXRun(delayed_usecs); | |||
| fChannel->Notify(ALL_CLIENTS, kXRunCallback, 0); | |||
| fChannel.Notify(ALL_CLIENTS, kXRunCallback, 0); | |||
| } | |||
| void JackEngine::NotifyXRun(int refnum) | |||
| @@ -478,7 +473,7 @@ int JackEngine::ClientExternalOpen(const char* name, int pid, int* ref, int* sha | |||
| JackExternalClient* client = new JackExternalClient(); | |||
| if (!fSynchroTable[refnum]->Allocate(name, fEngineControl->fServerName, 0)) { | |||
| if (!fSynchroTable[refnum].Allocate(name, fEngineControl->fServerName, 0)) { | |||
| jack_error("Cannot allocate synchro"); | |||
| goto error; | |||
| } | |||
| @@ -488,7 +483,7 @@ int JackEngine::ClientExternalOpen(const char* name, int pid, int* ref, int* sha | |||
| goto error; | |||
| } | |||
| if (!fSignal->TimedWait(DRIVER_OPEN_TIMEOUT * 1000000)) { | |||
| if (!fSignal.TimedWait(DRIVER_OPEN_TIMEOUT * 1000000)) { | |||
| // Failure if RT thread is not running (problem with the driver...) | |||
| jack_error("Driver is not running"); | |||
| goto error; | |||
| @@ -510,7 +505,7 @@ int JackEngine::ClientExternalOpen(const char* name, int pid, int* ref, int* sha | |||
| error: | |||
| // Cleanup... | |||
| fSynchroTable[refnum]->Destroy(); | |||
| fSynchroTable[refnum].Destroy(); | |||
| fClientTable[refnum] = 0; | |||
| client->Close(); | |||
| delete client; | |||
| @@ -528,12 +523,12 @@ int JackEngine::ClientInternalOpen(const char* name, int* ref, JackEngineControl | |||
| goto error; | |||
| } | |||
| if (!fSynchroTable[refnum]->Allocate(name, fEngineControl->fServerName, 0)) { | |||
| if (!fSynchroTable[refnum].Allocate(name, fEngineControl->fServerName, 0)) { | |||
| jack_error("Cannot allocate synchro"); | |||
| goto error; | |||
| } | |||
| if (wait && !fSignal->TimedWait(DRIVER_OPEN_TIMEOUT * 1000000)) { | |||
| if (wait && !fSignal.TimedWait(DRIVER_OPEN_TIMEOUT * 1000000)) { | |||
| // Failure if RT thread is not running (problem with the driver...) | |||
| jack_error("Driver is not running"); | |||
| goto error; | |||
| @@ -555,7 +550,7 @@ int JackEngine::ClientInternalOpen(const char* name, int* ref, JackEngineControl | |||
| error: | |||
| // Cleanup... | |||
| fSynchroTable[refnum]->Destroy(); | |||
| fSynchroTable[refnum].Destroy(); | |||
| fClientTable[refnum] = 0; | |||
| return -1; | |||
| } | |||
| @@ -608,7 +603,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.TimedWait(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); | |||
| } | |||
| } | |||
| @@ -617,7 +612,7 @@ int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wai | |||
| NotifyRemoveClient(client->GetClientControl()->fName, client->GetClientControl()->fRefNum); | |||
| // Cleanup... | |||
| fSynchroTable[refnum]->Destroy(); | |||
| fSynchroTable[refnum].Destroy(); | |||
| fEngineControl->ResetRollingUsecs(); | |||
| return 0; | |||
| } | |||
| @@ -632,7 +627,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.TimedWait(fEngineControl->fTimeOutUsecs * 10)) { | |||
| jack_error("JackEngine::ClientActivate wait error ref = %ld name = %s", refnum, client->GetClientControl()->fName); | |||
| return -1; | |||
| } else { | |||
| @@ -668,7 +663,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.TimedWait(fEngineControl->fTimeOutUsecs * 10)) { | |||
| jack_error("JackEngine::ClientDeactivate wait error ref = %ld name = %s", refnum, client->GetClientControl()->fName); | |||
| return -1; | |||
| } else { | |||
| @@ -24,15 +24,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #include "JackGraphManager.h" | |||
| #include "JackSynchro.h" | |||
| #include "JackTransportEngine.h" | |||
| #include "JackPlatformProcessSync.h" | |||
| #include "JackPlatformServerNotifyChannel.h" | |||
| namespace Jack | |||
| { | |||
| class JackClientInterface; | |||
| struct JackEngineControl; | |||
| class JackServerNotifyChannelInterface; | |||
| class JackExternalClient; | |||
| class JackSyncInterface; | |||
| class JackEngineInterface | |||
| { | |||
| @@ -99,9 +99,9 @@ class JackEngine | |||
| JackGraphManager* fGraphManager; | |||
| JackEngineControl* fEngineControl; | |||
| JackClientInterface* fClientTable[CLIENT_NUM]; | |||
| JackSynchro** fSynchroTable; | |||
| JackServerNotifyChannelInterface* fChannel; /*! To communicate between the RT thread and server */ | |||
| JackSyncInterface* fSignal; | |||
| JackSynchro* fSynchroTable; | |||
| JackServerNotifyChannel fChannel; /*! To communicate between the RT thread and server */ | |||
| JackProcessSync fSignal; | |||
| jack_time_t fLastSwitchUsecs; | |||
| int ClientCloseAux(int refnum, JackClientInterface* client, bool wait); | |||
| @@ -127,7 +127,7 @@ class JackEngine | |||
| public: | |||
| JackEngine(JackGraphManager* manager, JackSynchro** table, JackEngineControl* controler); | |||
| JackEngine(JackGraphManager* manager, JackSynchro* table, JackEngineControl* controler); | |||
| ~JackEngine(); | |||
| int Open(); | |||
| @@ -33,19 +33,17 @@ namespace Jack | |||
| JackExternalClient::JackExternalClient(): fClientControl(NULL) | |||
| { | |||
| fChannel = JackGlobals::MakeNotifyChannel(); | |||
| } | |||
| JackExternalClient::~JackExternalClient() | |||
| { | |||
| delete fChannel; | |||
| } | |||
| int JackExternalClient::ClientNotify(int refnum, const char* name, int notify, int sync, int value1, int value2) | |||
| { | |||
| int result = -1; | |||
| jack_log("JackExternalClient::ClientNotify ref = %ld name = %s notify = %ld", refnum, name, notify); | |||
| fChannel->ClientNotify(refnum, name, notify, sync, value1, value2, &result); | |||
| fChannel.ClientNotify(refnum, name, notify, sync, value1, value2, &result); | |||
| return result; | |||
| } | |||
| @@ -53,7 +51,7 @@ int JackExternalClient::Open(const char* name, int pid, int refnum, int* shared_ | |||
| { | |||
| try { | |||
| if (fChannel->Open(name) < 0) { | |||
| if (fChannel.Open(name) < 0) { | |||
| jack_error("Cannot connect to client name = %s\n", name); | |||
| return -1; | |||
| } | |||
| @@ -75,7 +73,7 @@ int JackExternalClient::Open(const char* name, int pid, int refnum, int* shared_ | |||
| int JackExternalClient::Close() | |||
| { | |||
| fChannel->Close(); | |||
| fChannel.Close(); | |||
| delete fClientControl; | |||
| return 0; | |||
| } | |||
| @@ -22,11 +22,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #define __JackExternalClient__ | |||
| #include "JackClientInterface.h" | |||
| #include "JackPlatformNotifyChannel.h" | |||
| namespace Jack | |||
| { | |||
| class JackNotifyChannelInterface; | |||
| struct JackClientControl; | |||
| /*! | |||
| @@ -38,7 +38,7 @@ class JackExternalClient : public JackClientInterface | |||
| private: | |||
| JackNotifyChannelInterface* fChannel; /*! Server/client communication channel */ | |||
| JackNotifyChannel fChannel; /*! Server/client communication channel */ | |||
| JackClientControl* fClientControl; /*! Client control in shared memory */ | |||
| public: | |||
| @@ -32,7 +32,7 @@ namespace Jack | |||
| \brief Inter process synchronization using Fifo. | |||
| */ | |||
| class JackFifo : public JackSynchro | |||
| class JackFifo : public detail::JackSynchro | |||
| { | |||
| private: | |||
| @@ -48,9 +48,7 @@ class JackFifo : public JackSynchro | |||
| public: | |||
| JackFifo(): JackSynchro(), fFifo( -1) | |||
| {} | |||
| virtual ~JackFifo() | |||
| JackFifo(): fFifo( -1) | |||
| {} | |||
| bool Signal(); | |||
| @@ -35,7 +35,7 @@ class JackFreewheelDriver : public JackDriver | |||
| public: | |||
| JackFreewheelDriver(JackEngineInterface* engine, JackSynchro** table): JackDriver("freewheel", "", engine, table) | |||
| JackFreewheelDriver(JackEngineInterface* engine, JackSynchro* table): JackDriver("freewheel", "", engine, table) | |||
| {} | |||
| virtual ~JackFreewheelDriver() | |||
| {} | |||
| @@ -24,62 +24,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #include "JackGlobals.h" | |||
| #include "JackError.h" | |||
| namespace Jack | |||
| { | |||
| JackFactoryImpl* JackGlobals::fInstance; | |||
| void JackGlobals::InitServer() | |||
| { | |||
| jack_log("JackGlobals InitServer"); | |||
| if (!fInstance) { | |||
| #ifdef __APPLE__ | |||
| fInstance = new JackFactoryOSXServer(); | |||
| #endif | |||
| #ifdef WIN32 | |||
| fInstance = new JackFactoryWindowsServer(); | |||
| #endif | |||
| #ifdef __linux__ | |||
| fInstance = new JackFactoryLinuxServer(); | |||
| #endif | |||
| } | |||
| } | |||
| void JackGlobals::InitClient() | |||
| { | |||
| jack_log("JackGlobals InitClient"); | |||
| if (!fInstance) { | |||
| #ifdef __APPLE__ | |||
| fInstance = new JackFactoryOSXClient(); | |||
| #endif | |||
| #ifdef WIN32 | |||
| fInstance = new JackFactoryWindowsClient(); | |||
| #endif | |||
| #ifdef __linux__ | |||
| fInstance = new JackFactoryLinuxClient(); | |||
| #endif | |||
| } | |||
| } | |||
| void JackGlobals::Destroy() | |||
| { | |||
| jack_log("JackGlobals Destroy"); | |||
| if (fInstance) { | |||
| delete fInstance; | |||
| fInstance = NULL; | |||
| } | |||
| } | |||
| } // end of namespace | |||
| static bool gKeyRealtimeInitialized = false; | |||
| static bool g_key_log_function_initialized = false; | |||
| @@ -21,239 +21,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #define __JackGlobals__ | |||
| #include "JackError.h" | |||
| #include "JackThread.h" | |||
| #include "JackThread.h" | |||
| #include "JackExports.h" | |||
| namespace Jack | |||
| { | |||
| class JackSynchro; | |||
| class JackServerNotifyChannelInterface; | |||
| class JackClientChannelInterface; | |||
| class JackNotifyChannelInterface; | |||
| class JackServerChannelInterface; | |||
| class JackSyncInterface; | |||
| class JackThread; | |||
| class JackDriverClientInterface; | |||
| class JackRunnableInterface; | |||
| class JackEngine; | |||
| /*! | |||
| \brief Factory description | |||
| \todo possibly use in a dynamic way to test different communication/synchro implementations. | |||
| */ | |||
| class JackFactoryImpl | |||
| { | |||
| public: | |||
| JackFactoryImpl() | |||
| {} | |||
| virtual ~JackFactoryImpl() | |||
| {} | |||
| virtual JackSynchro* MakeSynchro() = 0; | |||
| virtual JackServerNotifyChannelInterface* MakeServerNotifyChannel() = 0; | |||
| virtual JackClientChannelInterface* MakeClientChannel() = 0; | |||
| virtual JackNotifyChannelInterface* MakeNotifyChannel() = 0; | |||
| virtual JackServerChannelInterface* MakeServerChannel() = 0; | |||
| virtual JackSyncInterface* MakeInterProcessSync() = 0; | |||
| virtual JackThread* MakeThread(JackRunnableInterface* runnable) = 0; | |||
| }; | |||
| #ifdef __linux__ | |||
| class JackFactoryLinuxServer : public JackFactoryImpl | |||
| { | |||
| public: | |||
| JackFactoryLinuxServer() | |||
| {} | |||
| virtual ~JackFactoryLinuxServer() | |||
| {} | |||
| JackSynchro* MakeSynchro(); | |||
| JackServerNotifyChannelInterface* MakeServerNotifyChannel(); | |||
| JackClientChannelInterface* MakeClientChannel(); | |||
| JackNotifyChannelInterface* MakeNotifyChannel(); | |||
| JackServerChannelInterface* MakeServerChannel(); | |||
| JackSyncInterface* MakeInterProcessSync(); | |||
| JackThread* MakeThread(JackRunnableInterface* runnable); | |||
| }; | |||
| class JackFactoryLinuxClient : public JackFactoryImpl | |||
| { | |||
| public: | |||
| JackFactoryLinuxClient() | |||
| {} | |||
| virtual ~JackFactoryLinuxClient() | |||
| {} | |||
| JackSynchro* MakeSynchro(); | |||
| JackServerNotifyChannelInterface* MakeServerNotifyChannel(); | |||
| JackClientChannelInterface* MakeClientChannel(); | |||
| JackNotifyChannelInterface* MakeNotifyChannel(); | |||
| JackServerChannelInterface* MakeServerChannel(); | |||
| JackSyncInterface* MakeInterProcessSync(); | |||
| JackThread* MakeThread(JackRunnableInterface* runnable); | |||
| }; | |||
| #endif | |||
| #ifdef WIN32 | |||
| class JackFactoryWindowsServer : public JackFactoryImpl | |||
| { | |||
| public: | |||
| JackFactoryWindowsServer() | |||
| {} | |||
| virtual ~JackFactoryWindowsServer() | |||
| {} | |||
| JackSynchro* MakeSynchro(); | |||
| JackServerNotifyChannelInterface* MakeServerNotifyChannel(); | |||
| JackClientChannelInterface* MakeClientChannel(); | |||
| JackNotifyChannelInterface* MakeNotifyChannel(); | |||
| JackServerChannelInterface* MakeServerChannel(); | |||
| JackSyncInterface* MakeInterProcessSync(); | |||
| JackThread* MakeThread(JackRunnableInterface* runnable); | |||
| }; | |||
| class JackFactoryWindowsClient : public JackFactoryImpl | |||
| { | |||
| public: | |||
| JackFactoryWindowsClient() | |||
| {} | |||
| virtual ~JackFactoryWindowsClient() | |||
| {} | |||
| JackSynchro* MakeSynchro(); | |||
| JackServerNotifyChannelInterface* MakeServerNotifyChannel(); | |||
| JackClientChannelInterface* MakeClientChannel(); | |||
| JackNotifyChannelInterface* MakeNotifyChannel(); | |||
| JackServerChannelInterface* MakeServerChannel(); | |||
| JackSyncInterface* MakeInterProcessSync(); | |||
| JackThread* MakeThread(JackRunnableInterface* runnable); | |||
| }; | |||
| #endif | |||
| #if defined(__APPLE__) | |||
| class JackFactoryOSXServer : public JackFactoryImpl | |||
| { | |||
| public: | |||
| JackFactoryOSXServer() | |||
| {} | |||
| virtual ~JackFactoryOSXServer() | |||
| {} | |||
| JackSynchro* MakeSynchro(); | |||
| JackServerNotifyChannelInterface* MakeServerNotifyChannel(); | |||
| JackClientChannelInterface* MakeClientChannel(); | |||
| JackNotifyChannelInterface* MakeNotifyChannel(); | |||
| JackServerChannelInterface* MakeServerChannel(); | |||
| JackSyncInterface* MakeInterProcessSync(); | |||
| JackThread* MakeThread(JackRunnableInterface* runnable); | |||
| }; | |||
| class JackFactoryOSXClient : public JackFactoryImpl | |||
| { | |||
| public: | |||
| JackFactoryOSXClient() | |||
| {} | |||
| virtual ~JackFactoryOSXClient() | |||
| {} | |||
| JackSynchro* MakeSynchro(); | |||
| JackServerNotifyChannelInterface* MakeServerNotifyChannel(); | |||
| JackClientChannelInterface* MakeClientChannel(); | |||
| JackNotifyChannelInterface* MakeNotifyChannel(); | |||
| JackServerChannelInterface* MakeServerChannel(); | |||
| JackSyncInterface* MakeInterProcessSync(); | |||
| JackThread* MakeThread(JackRunnableInterface* runnable); | |||
| }; | |||
| #endif | |||
| /*! | |||
| \brief Factory for OS specific ressources. | |||
| */ | |||
| class JackGlobals | |||
| { | |||
| private: | |||
| static JackFactoryImpl* fInstance; | |||
| public: | |||
| JackGlobals() | |||
| {} | |||
| virtual ~JackGlobals() | |||
| {} | |||
| static JackSynchro* MakeSynchro() | |||
| { | |||
| return fInstance->MakeSynchro(); | |||
| } | |||
| static JackServerNotifyChannelInterface* MakeServerNotifyChannel() | |||
| { | |||
| return fInstance->MakeServerNotifyChannel(); | |||
| } | |||
| static JackClientChannelInterface* MakeClientChannel() | |||
| { | |||
| return fInstance->MakeClientChannel(); | |||
| } | |||
| static JackNotifyChannelInterface* MakeNotifyChannel() | |||
| { | |||
| return fInstance->MakeNotifyChannel(); | |||
| } | |||
| static JackServerChannelInterface* MakeServerChannel() | |||
| { | |||
| return fInstance->MakeServerChannel(); | |||
| } | |||
| static JackSyncInterface* MakeInterProcessSync() | |||
| { | |||
| return fInstance->MakeInterProcessSync(); | |||
| } | |||
| static JackThread* MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return fInstance->MakeThread(runnable); | |||
| } | |||
| static void InitServer(); | |||
| static void InitClient(); | |||
| static void Destroy(); | |||
| }; | |||
| namespace detail | |||
| { | |||
| struct JackGlobalsServerInitializer | |||
| { | |||
| JackGlobalsServerInitializer(void) | |||
| { | |||
| JackGlobals::InitServer(); | |||
| } | |||
| ~JackGlobalsServerInitializer(void) | |||
| { | |||
| JackGlobals::Destroy(); | |||
| } | |||
| }; | |||
| } | |||
| #include "JackPlatformSynchro.h" | |||
| #include "JackPlatformProcessSync.h" | |||
| #include "JackPlatformThread.h" | |||
| } // end of namespace | |||
| #ifdef __cplusplus | |||
| extern "C" | |||
| @@ -1,485 +0,0 @@ | |||
| /* | |||
| Copyright (C) 2004-2008 Grame | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU Lesser General Public License as published by | |||
| the Free Software Foundation; either version 2.1 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU Lesser General Public License for more details. | |||
| You should have received a copy of the GNU Lesser General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| */ | |||
| #if defined(HAVE_CONFIG_H) | |||
| #include "config.h" | |||
| #endif | |||
| #include "JackGlobals.h" | |||
| // OSX | |||
| #if defined(__APPLE__) | |||
| #include "JackCoreAudioDriver.h" | |||
| #include "JackMachServerNotifyChannel.h" | |||
| #include "JackMachNotifyChannel.h" | |||
| #include "JackMachServerChannel.h" | |||
| #include "JackMachClientChannel.h" | |||
| #include "JackMachThread.h" | |||
| #include "JackMachSemaphore.h" | |||
| #include "JackProcessSync.h" | |||
| #include "JackSocketServerNotifyChannel.h" | |||
| #include "JackSocketNotifyChannel.h" | |||
| #include "JackSocketServerChannel.h" | |||
| #include "JackSocketClientChannel.h" | |||
| #include "JackPosixThread.h" | |||
| #include "JackPosixSemaphore.h" | |||
| #include "JackFifo.h" | |||
| #endif | |||
| // WINDOWS | |||
| #ifdef WIN32 | |||
| #include "JackWinProcessSync.h" | |||
| #include "JackWinNamedPipeClientChannel.h" | |||
| #include "JackWinEvent.h" | |||
| #include "JackWinSemaphore.h" | |||
| #include "JackWinThread.h" | |||
| #endif | |||
| // LINUX | |||
| #ifdef __linux__ | |||
| #include "linux/alsa/JackAlsaDriver.h" | |||
| #include "JackProcessSync.h" | |||
| #include "JackSocketServerNotifyChannel.h" | |||
| #include "JackSocketNotifyChannel.h" | |||
| #include "JackSocketServerChannel.h" | |||
| #include "JackSocketClientChannel.h" | |||
| #include "JackPosixThread.h" | |||
| #include "JackPosixSemaphore.h" | |||
| #include "JackFifo.h" | |||
| #endif | |||
| using namespace std; | |||
| namespace Jack | |||
| { | |||
| #ifdef WIN32 | |||
| JackSynchro* JackFactoryWindowsServer::MakeSynchro() {return NULL;} | |||
| JackServerNotifyChannelInterface* JackFactoryWindowsServer::MakeServerNotifyChannel() {return NULL;} | |||
| JackClientChannelInterface* JackFactoryWindowsServer::MakeClientChannel() {return NULL;} | |||
| JackNotifyChannelInterface* JackFactoryWindowsServer::MakeNotifyChannel() {return NULL;} | |||
| JackServerChannelInterface* JackFactoryWindowsServer::MakeServerChannel() {return NULL;} | |||
| JackSyncInterface* JackFactoryWindowsServer::MakeInterProcessSync() {return NULL;} | |||
| JackThread* JackFactoryWindowsServer::MakeThread(JackRunnableInterface* runnable) {return NULL;} | |||
| JackSynchro* JackFactoryWindowsClient::MakeSynchro() | |||
| { | |||
| return new JackWinSemaphore(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryWindowsClient::MakeServerNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackClientChannelInterface* JackFactoryWindowsClient::MakeClientChannel() | |||
| { | |||
| return new JackWinNamedPipeClientChannel(); | |||
| } | |||
| JackNotifyChannelInterface* JackFactoryWindowsClient::MakeNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackServerChannelInterface* JackFactoryWindowsClient::MakeServerChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackSyncInterface* JackFactoryWindowsClient::MakeInterProcessSync() | |||
| { | |||
| return new JackWinProcessSync(); | |||
| } | |||
| JackThread* JackFactoryWindowsClient::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackWinThread(runnable); | |||
| } | |||
| #endif | |||
| #ifdef __linux__ | |||
| #if defined(SOCKET_RPC_POSIX_SEMA) | |||
| JackSynchro* JackFactoryLinuxClient::MakeSynchro() | |||
| { | |||
| return new JackPosixSemaphore(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryLinuxClient::MakeServerNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackClientChannelInterface* JackFactoryLinuxClient::MakeClientChannel() | |||
| { | |||
| return new JackSocketClientChannel(); | |||
| } | |||
| JackNotifyChannelInterface* JackFactoryLinuxClient::MakeNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackServerChannelInterface* JackFactoryLinuxClient::MakeServerChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackSyncInterface* JackFactoryLinuxClient::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryLinuxClient::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(SOCKET_RPC_FIFO_SEMA) | |||
| JackSynchro* JackFactoryLinuxServer::MakeSynchro() {return NULL;} | |||
| JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel() {return NULL;} | |||
| JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel() {return NULL;} | |||
| JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel() {return NULL;} | |||
| JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel() {return NULL;} | |||
| JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync() {return NULL;} | |||
| JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable) {return NULL;} | |||
| JackSynchro* JackFactoryLinuxClient::MakeSynchro() | |||
| { | |||
| return new JackFifo(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryLinuxClient::MakeServerNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackClientChannelInterface* JackFactoryLinuxClient::MakeClientChannel() | |||
| { | |||
| return new JackSocketClientChannel(); | |||
| } | |||
| JackNotifyChannelInterface* JackFactoryLinuxClient::MakeNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackServerChannelInterface* JackFactoryLinuxClient::MakeServerChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackSyncInterface* JackFactoryLinuxClient::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryLinuxClient::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(SOCKET_RPC_FIFO_SEMA_DUMMY) | |||
| JackSynchro* JackFactoryLinuxClient::MakeSynchro() | |||
| { | |||
| return new JackFifo(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryLinuxClient::MakeServerNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackClientChannelInterface* JackFactoryLinuxClient::MakeClientChannel() | |||
| { | |||
| return new JackSocketClientChannel(); | |||
| } | |||
| JackNotifyChannelInterface* JackFactoryLinuxClient::MakeNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackServerChannelInterface* JackFactoryLinuxClient::MakeServerChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackSyncInterface* JackFactoryLinuxClient::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryLinuxClient::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #endif | |||
| #if defined(__APPLE__) | |||
| #if defined(MACH_RPC_MACH_SEMA) | |||
| // Mach RPC + Mach Semaphore | |||
| JackSynchro* JackFactoryOSXServer::MakeSynchro() {return NULL;} | |||
| JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel() {return NULL;} | |||
| JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel() {return NULL;} | |||
| JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel() {return NULL;} | |||
| JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel() {return NULL;} | |||
| JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync() {return NULL;} | |||
| JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable) {return NULL;} | |||
| JackSynchro* JackFactoryOSXClient::MakeSynchro() | |||
| { | |||
| return new JackMachSemaphore(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel() | |||
| { | |||
| return new JackMachClientChannel(); | |||
| } | |||
| JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel() | |||
| { | |||
| return NULL; | |||
| } // Not used | |||
| JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(SOCKET_RPC_POSIX_SEMA) | |||
| // Socket RPC + Posix Semaphore | |||
| JackSynchro* JackFactoryOSXClient::MakeSynchro() | |||
| { | |||
| return new JackPosixSemaphore(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel() | |||
| { | |||
| return new JackSocketClientChannel(); | |||
| } | |||
| JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(SOCKET_RPC_FIFO_SEMA) | |||
| // Socket RPC + Fifo Semaphore | |||
| JackSynchro* JackFactoryOSXClient::MakeSynchro() | |||
| { | |||
| return new JackFifo(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel() | |||
| { | |||
| return new JackSocketClientChannel(); | |||
| } | |||
| JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(MACH_RPC_FIFO_SEMA) | |||
| // Mach RPC + Fifo Semaphore | |||
| JackSynchro* JackFactoryOSXClient::MakeSynchro() | |||
| { | |||
| return new JackFifo(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel() | |||
| { | |||
| return new JackMachClientChannel(); | |||
| } | |||
| JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(MACH_RPC_POSIX_SEMA) | |||
| // Mach RPC + Posix Semaphore | |||
| JackSynchro* JackFactoryOSXClient::MakeSynchro() | |||
| { | |||
| return new JackPosixSemaphore(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel() | |||
| { | |||
| return new JackMachClientChannel(); | |||
| } | |||
| JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined SOCKET_RPC_MACH_SEMA | |||
| // Socket RPC + Mach Semaphore | |||
| JackSynchro* JackFactoryOSXClient::MakeSynchro() | |||
| { | |||
| return new JackMachSemaphore(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel() | |||
| { | |||
| return new JackSocketClientChannel(); | |||
| } | |||
| JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel() | |||
| { | |||
| return NULL; | |||
| } | |||
| // Not used | |||
| JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #endif | |||
| } // end of namespace | |||
| @@ -1,492 +0,0 @@ | |||
| /* | |||
| Copyright (C) 2004-2008 Grame | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU General Public License as published by | |||
| the Free Software Foundation; either version 2 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU General Public License for more details. | |||
| You should have received a copy of the GNU General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| #if defined(HAVE_CONFIG_H) | |||
| #include "config.h" | |||
| #endif | |||
| #ifdef WIN32 | |||
| #pragma warning (disable : 4786) | |||
| #endif | |||
| #include "JackGlobals.h" | |||
| // OSX | |||
| #if defined(__APPLE__) | |||
| #include "JackCoreAudioDriver.h" | |||
| #include "JackMachServerNotifyChannel.h" | |||
| #include "JackMachNotifyChannel.h" | |||
| #include "JackMachServerChannel.h" | |||
| #include "JackMachClientChannel.h" | |||
| #include "JackMachThread.h" | |||
| #include "JackMachSemaphore.h" | |||
| #include "JackProcessSync.h" | |||
| #include "JackSocketServerNotifyChannel.h" | |||
| #include "JackSocketNotifyChannel.h" | |||
| #include "JackSocketServerChannel.h" | |||
| #include "JackSocketClientChannel.h" | |||
| #include "JackPosixThread.h" | |||
| #include "JackPosixSemaphore.h" | |||
| #include "JackFifo.h" | |||
| #endif | |||
| // WINDOWS | |||
| #ifdef WIN32 | |||
| #include "JackWinProcessSync.h" | |||
| #include "JackWinNamedPipeServerNotifyChannel.h" | |||
| #include "JackWinNamedPipeNotifyChannel.h" | |||
| #include "JackWinNamedPipeServerChannel.h" | |||
| #include "JackWinNamedPipeClientChannel.h" | |||
| #include "JackWinEvent.h" | |||
| #include "JackWinSemaphore.h" | |||
| #include "JackWinThread.h" | |||
| #endif | |||
| // LINUX | |||
| #ifdef __linux__ | |||
| #include "linux/alsa/JackAlsaDriver.h" | |||
| #include "JackProcessSync.h" | |||
| #include "JackSocketServerNotifyChannel.h" | |||
| #include "JackSocketNotifyChannel.h" | |||
| #include "JackSocketServerChannel.h" | |||
| #include "JackSocketClientChannel.h" | |||
| #include "JackPosixThread.h" | |||
| #include "JackPosixSemaphore.h" | |||
| #include "JackFifo.h" | |||
| #endif | |||
| // COMMON | |||
| #include "JackDummyDriver.h" | |||
| #include "JackAudioDriver.h" | |||
| using namespace std; | |||
| namespace Jack | |||
| { | |||
| #ifdef WIN32 | |||
| JackSynchro* JackFactoryWindowsClient::MakeSynchro() {return NULL;} | |||
| JackServerNotifyChannelInterface* JackFactoryWindowsClient::MakeServerNotifyChannel() {return NULL;} | |||
| JackClientChannelInterface* JackFactoryWindowsClient::MakeClientChannel() {return NULL;} | |||
| JackNotifyChannelInterface* JackFactoryWindowsClient::MakeNotifyChannel() {return NULL;} | |||
| JackServerChannelInterface* JackFactoryWindowsClient::MakeServerChannel() {return NULL;} | |||
| JackSyncInterface* JackFactoryWindowsClient::MakeInterProcessSync() {return NULL;} | |||
| JackThread* JackFactoryWindowsClient::MakeThread(JackRunnableInterface* runnable) {return NULL;} | |||
| JackSynchro* JackFactoryWindowsServer::MakeSynchro() | |||
| { | |||
| return new JackWinSemaphore(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryWindowsServer::MakeServerNotifyChannel() | |||
| { | |||
| return new JackWinNamedPipeServerNotifyChannel(); | |||
| } | |||
| JackClientChannelInterface* JackFactoryWindowsServer::MakeClientChannel() | |||
| { | |||
| return NULL; | |||
| } // Not used | |||
| JackNotifyChannelInterface* JackFactoryWindowsServer::MakeNotifyChannel() | |||
| { | |||
| return new JackWinNamedPipeNotifyChannel(); | |||
| } | |||
| JackServerChannelInterface* JackFactoryWindowsServer::MakeServerChannel() | |||
| { | |||
| return new JackWinNamedPipeServerChannel(); | |||
| } | |||
| JackSyncInterface* JackFactoryWindowsServer::MakeInterProcessSync() | |||
| { | |||
| return new JackWinProcessSync(); | |||
| } | |||
| JackThread* JackFactoryWindowsServer::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackWinThread(runnable); | |||
| } | |||
| #endif | |||
| #ifdef __linux__ | |||
| #if defined(SOCKET_RPC_POSIX_SEMA) | |||
| JackSynchro* JackFactoryLinuxServer::MakeSynchro() | |||
| { | |||
| return new JackPosixSemaphore(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel() | |||
| { | |||
| return new JackSocketServerNotifyChannel(); | |||
| } | |||
| JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel() | |||
| { | |||
| return NULL; | |||
| } // Not used | |||
| JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel() | |||
| { | |||
| return new JackSocketNotifyChannel(); | |||
| } | |||
| JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel() | |||
| { | |||
| return new JackSocketServerChannel(); | |||
| } | |||
| JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(SOCKET_RPC_FIFO_SEMA) | |||
| JackSynchro* JackFactoryLinuxClient::MakeSynchro() {return NULL;} | |||
| JackServerNotifyChannelInterface* JackFactoryLinuxClient::MakeServerNotifyChannel() {return NULL;} | |||
| JackClientChannelInterface* JackFactoryLinuxClient::MakeClientChannel() {return NULL;} | |||
| JackNotifyChannelInterface* JackFactoryLinuxClient::MakeNotifyChannel() {return NULL;} | |||
| JackServerChannelInterface* JackFactoryLinuxClient::MakeServerChannel() {return NULL;} | |||
| JackSyncInterface* JackFactoryLinuxClient::MakeInterProcessSync() {return NULL;} | |||
| JackThread* JackFactoryLinuxClient::MakeThread(JackRunnableInterface* runnable) {return NULL;} | |||
| JackSynchro* JackFactoryLinuxServer::MakeSynchro() | |||
| { | |||
| return new JackFifo(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel() | |||
| { | |||
| return new JackSocketServerNotifyChannel(); | |||
| } | |||
| JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel() | |||
| { | |||
| return NULL; | |||
| } // Not used | |||
| JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel() | |||
| { | |||
| return new JackSocketNotifyChannel(); | |||
| } | |||
| JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel() | |||
| { | |||
| return new JackSocketServerChannel(); | |||
| } | |||
| JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(SOCKET_RPC_FIFO_SEMA_DUMMY) | |||
| JackSynchro* JackFactoryLinuxServer::MakeSynchro() | |||
| { | |||
| return new JackFifo(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel() | |||
| { | |||
| return new JackSocketServerNotifyChannel(); | |||
| } | |||
| JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel() | |||
| { | |||
| return NULL; | |||
| } // Not used | |||
| JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel() | |||
| { | |||
| return new JackSocketNotifyChannel(); | |||
| } | |||
| JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel() | |||
| { | |||
| return new JackSocketServerChannel(); | |||
| } | |||
| JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #endif | |||
| #if defined(__APPLE__) | |||
| #if defined(MACH_RPC_MACH_SEMA) | |||
| // Mach RPC + Mach Semaphore | |||
| JackSynchro* JackFactoryOSXClient::MakeSynchro() {return NULL;} | |||
| JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel() {return NULL;} | |||
| JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel() {return NULL;} | |||
| JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel() {return NULL;} | |||
| JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel() {return NULL;} | |||
| JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync() {return NULL;} | |||
| JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable) {return NULL;} | |||
| JackSynchro* JackFactoryOSXServer::MakeSynchro() | |||
| { | |||
| return new JackMachSemaphore(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel() | |||
| { | |||
| return new JackMachServerNotifyChannel(); | |||
| } | |||
| JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel() | |||
| { | |||
| return NULL; | |||
| } // Not used | |||
| JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel() | |||
| { | |||
| return new JackMachNotifyChannel(); | |||
| } | |||
| JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel() | |||
| { | |||
| return new JackMachServerChannel(); | |||
| } | |||
| JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(SOCKET_RPC_POSIX_SEMA) | |||
| // Socket RPC + Posix Semaphore | |||
| JackSynchro* JackFactoryOSXServer::MakeSynchro() | |||
| { | |||
| return new JackPosixSemaphore(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel() | |||
| { | |||
| return new JackSocketServerNotifyChannel(); | |||
| } | |||
| JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel() | |||
| { | |||
| return NULL; | |||
| } // Not used | |||
| JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel() | |||
| { | |||
| return new JackSocketNotifyChannel(); | |||
| } | |||
| JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel() | |||
| { | |||
| return new JackSocketServerChannel(); | |||
| } | |||
| JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(SOCKET_RPC_FIFO_SEMA) | |||
| // Socket RPC + Fifo Semaphore | |||
| JackSynchro* JackFactoryOSXServer::MakeSynchro() | |||
| { | |||
| return new JackFifo(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel() | |||
| { | |||
| return new JackSocketServerNotifyChannel(); | |||
| } | |||
| JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel() | |||
| { | |||
| return NULL; | |||
| } // Not used | |||
| JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel() | |||
| { | |||
| return new JackSocketNotifyChannel(); | |||
| } | |||
| JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel() | |||
| { | |||
| return new JackSocketServerChannel(); | |||
| } | |||
| JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(MACH_RPC_FIFO_SEMA) | |||
| // Mach RPC + Fifo Semaphore | |||
| JackSynchro* JackFactoryOSXServer::MakeSynchro() | |||
| { | |||
| return new JackFifo(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel() | |||
| { | |||
| return new JackMachServerNotifyChannel(); | |||
| } | |||
| JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel() | |||
| { | |||
| return NULL; | |||
| } // Not used | |||
| JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel() | |||
| { | |||
| return new JackMachNotifyChannel(); | |||
| } | |||
| JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel() | |||
| { | |||
| return new JackMachServerChannel(); | |||
| } | |||
| JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(MACH_RPC_POSIX_SEMA) | |||
| // Mach RPC + Posix Semaphore | |||
| JackSynchro* JackFactoryOSXServer::MakeSynchro() | |||
| { | |||
| return new JackPosixSemaphore(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel() | |||
| { | |||
| return new JackMachServerNotifyChannel(); | |||
| } | |||
| JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel() | |||
| { | |||
| return NULL; | |||
| } // Not used | |||
| JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel() | |||
| { | |||
| return new JackMachNotifyChannel(); | |||
| } | |||
| JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel() | |||
| { | |||
| return new JackMachServerChannel(); | |||
| } | |||
| JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #if defined(SOCKET_RPC_MACH_SEMA) | |||
| // Socket RPC + Mac Semaphore | |||
| JackSynchro* JackFactoryOSXServer::MakeSynchro() | |||
| { | |||
| return new JackMachSemaphore(); | |||
| } | |||
| JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel() | |||
| { | |||
| return new JackSocketServerNotifyChannel(); | |||
| } | |||
| JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel() | |||
| { | |||
| return NULL; | |||
| } // Not used | |||
| JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel() | |||
| { | |||
| return new JackSocketNotifyChannel(); | |||
| } | |||
| JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel() | |||
| { | |||
| return new JackSocketServerChannel(); | |||
| } | |||
| JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync() | |||
| { | |||
| return new JackProcessSync(); | |||
| } | |||
| JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable) | |||
| { | |||
| return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS); | |||
| } | |||
| #endif | |||
| #endif | |||
| } // end of namespace | |||
| @@ -104,14 +104,14 @@ bool JackGraphManager::IsFinishedGraph() | |||
| } | |||
| // RT | |||
| int JackGraphManager::ResumeRefNum(JackClientControl* control, JackSynchro** table) | |||
| int JackGraphManager::ResumeRefNum(JackClientControl* control, JackSynchro* table) | |||
| { | |||
| JackConnectionManager* manager = ReadCurrentState(); | |||
| return manager->ResumeRefNum(control, table, fClientTiming); | |||
| } | |||
| // RT | |||
| int JackGraphManager::SuspendRefNum(JackClientControl* control, JackSynchro** table, long usec) | |||
| int JackGraphManager::SuspendRefNum(JackClientControl* control, JackSynchro* table, long usec) | |||
| { | |||
| JackConnectionManager* manager = ReadCurrentState(); | |||
| return manager->SuspendRefNum(control, table, fClientTiming, usec); | |||
| @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #include "JackConstants.h" | |||
| #include "JackConnectionManager.h" | |||
| #include "JackAtomicState.h" | |||
| #include "JackPlatformSynchro.h" | |||
| namespace Jack | |||
| { | |||
| @@ -108,8 +109,8 @@ class JackGraphManager : public JackShmMem, public JackAtomicState<JackConnectio | |||
| bool IsFinishedGraph(); | |||
| void InitRefNum(int refnum); | |||
| int ResumeRefNum(JackClientControl* control, JackSynchro** table); | |||
| int SuspendRefNum(JackClientControl* control, JackSynchro** table, long usecs); | |||
| int ResumeRefNum(JackClientControl* control, JackSynchro* table); | |||
| int SuspendRefNum(JackClientControl* control, JackSynchro* table, long usecs); | |||
| JackClientTiming* GetClientTiming(int refnum); | |||
| @@ -59,12 +59,12 @@ JackEngineControl* GetEngineControl() | |||
| return JackServer::fInstance->GetEngineControl(); | |||
| } | |||
| JackSynchro** GetSynchroTable() | |||
| JackSynchro* GetSynchroTable() | |||
| { | |||
| return JackServer::fInstance->GetSynchroTable(); | |||
| } | |||
| JackInternalClient::JackInternalClient(JackServer* server, JackSynchro** table): JackClient(table) | |||
| JackInternalClient::JackInternalClient(JackServer* server, JackSynchro* table): JackClient(table) | |||
| { | |||
| fClientControl = new JackClientControl(); | |||
| fChannel = new JackInternalClientChannel(server); | |||
| @@ -129,7 +129,7 @@ JackClientControl* JackInternalClient::GetClientControl() const | |||
| return fClientControl; | |||
| } | |||
| JackLoadableInternalClient::JackLoadableInternalClient(JackServer* server, JackSynchro** table, const char* so_name, const char* object_data) | |||
| JackLoadableInternalClient::JackLoadableInternalClient(JackServer* server, JackSynchro* table, const char* so_name, const char* object_data) | |||
| : JackInternalClient(server, table) | |||
| { | |||
| char path_to_so[PATH_MAX + 1]; | |||
| @@ -27,7 +27,6 @@ namespace Jack | |||
| { | |||
| struct JackEngineControl; | |||
| class JackClientChannelInterface; | |||
| /*! | |||
| \brief Internal clients in the server. | |||
| @@ -42,7 +41,7 @@ class JackInternalClient : public JackClient | |||
| public: | |||
| JackInternalClient(JackServer* server, JackSynchro** table); | |||
| JackInternalClient(JackServer* server, JackSynchro* table); | |||
| virtual ~JackInternalClient(); | |||
| int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status); | |||
| @@ -122,7 +121,7 @@ class JackLoadableInternalClient : public JackInternalClient | |||
| public: | |||
| JackLoadableInternalClient(JackServer* server, JackSynchro** table, const char* so_name, const char* object_data); | |||
| JackLoadableInternalClient(JackServer* server, JackSynchro* table, const char* so_name, const char* object_data); | |||
| virtual ~JackLoadableInternalClient(); | |||
| int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status); | |||
| @@ -29,7 +29,7 @@ namespace Jack | |||
| \brief JackClientChannel for server internal clients. | |||
| */ | |||
| class JackInternalClientChannel : public JackClientChannelInterface | |||
| class JackInternalClientChannel : public detail::JackClientChannelInterface | |||
| { | |||
| private: | |||
| @@ -25,13 +25,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #include "JackTime.h" | |||
| #include "JackLibGlobals.h" | |||
| #include "JackGlobals.h" | |||
| #include "JackChannel.h" | |||
| #include "JackPlatformClientChannel.h" | |||
| #include "JackTools.h" | |||
| namespace Jack | |||
| { | |||
| // Used for external C API (JackAPI.cpp) | |||
| JackGraphManager* GetGraphManager() | |||
| { | |||
| @@ -51,7 +50,7 @@ JackEngineControl* GetEngineControl() | |||
| } | |||
| } | |||
| JackSynchro** GetSynchroTable() | |||
| JackSynchro* GetSynchroTable() | |||
| { | |||
| return (JackLibGlobals::fGlobals ? JackLibGlobals::fGlobals->fSynchroTable : 0); | |||
| } | |||
| @@ -60,10 +59,10 @@ JackSynchro** GetSynchroTable() | |||
| // Client management | |||
| //------------------- | |||
| JackLibClient::JackLibClient(JackSynchro** table): JackClient(table) | |||
| JackLibClient::JackLibClient(JackSynchro* table): JackClient(table) | |||
| { | |||
| jack_log("JackLibClient::JackLibClient table = %x", table); | |||
| fChannel = JackGlobals::MakeClientChannel(); | |||
| fChannel = new JackClientChannel(); | |||
| } | |||
| JackLibClient::~JackLibClient() | |||
| @@ -113,7 +112,7 @@ int JackLibClient::Open(const char* server_name, const char* name, jack_options_ | |||
| SetupDriverSync(false); | |||
| // Connect shared synchro : the synchro must be usable in I/O mode when several clients live in the same process | |||
| if (!fSynchroTable[GetClientControl()->fRefNum]->Connect(name_res, fServerName)) { | |||
| if (!fSynchroTable[GetClientControl()->fRefNum].Connect(name_res, fServerName)) { | |||
| jack_error("Cannot ConnectSemaphore %s client", name_res); | |||
| goto error; | |||
| } | |||
| @@ -140,13 +139,13 @@ int JackLibClient::ClientNotifyImp(int refnum, const char* name, int notify, int | |||
| case kAddClient: | |||
| jack_log("JackClient::AddClient name = %s, ref = %ld ", name, refnum); | |||
| // the synchro must be usable in I/O mode when several clients live in the same process | |||
| res = fSynchroTable[refnum]->Connect(name, fServerName) ? 0 : -1; | |||
| res = fSynchroTable[refnum].Connect(name, fServerName) ? 0 : -1; | |||
| break; | |||
| case kRemoveClient: | |||
| jack_log("JackClient::RemoveClient name = %s, ref = %ld ", name, refnum); | |||
| if (strcmp(GetClientControl()->fName, name) != 0) | |||
| res = fSynchroTable[refnum]->Disconnect() ? 0 : -1; | |||
| res = fSynchroTable[refnum].Disconnect() ? 0 : -1; | |||
| break; | |||
| } | |||
| @@ -41,7 +41,7 @@ class JackLibClient : public JackClient | |||
| public: | |||
| JackLibClient(JackSynchro** table); | |||
| JackLibClient(JackSynchro* table); | |||
| virtual ~JackLibClient(); | |||
| int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status); | |||
| @@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #include <map> | |||
| #endif | |||
| #include "JackGlobals.h" | |||
| #include "JackPlatformSynchro.h" | |||
| #include "JackGraphManager.h" | |||
| #include "JackMessageBuffer.h" | |||
| #include "JackTime.h" | |||
| @@ -46,7 +47,7 @@ struct JackLibGlobals | |||
| { | |||
| JackShmReadWritePtr<JackGraphManager> fGraphManager; /*! Shared memory Port manager */ | |||
| JackShmReadWritePtr<JackEngineControl> fEngineControl; /*! Shared engine control */ // transport engine has to be writable | |||
| JackSynchro* fSynchroTable[CLIENT_NUM]; /*! Shared synchro table */ | |||
| JackSynchro fSynchroTable[CLIENT_NUM]; /*! Shared synchro table */ | |||
| #ifdef __APPLE__ | |||
| std::map<mach_port_t, JackClient*> fClientTable; /*! Client table */ | |||
| #endif | |||
| @@ -58,8 +59,6 @@ struct JackLibGlobals | |||
| { | |||
| jack_log("JackLibGlobals"); | |||
| JackMessageBuffer::Create(); | |||
| for (int i = 0; i < CLIENT_NUM; i++) | |||
| fSynchroTable[i] = JackGlobals::MakeSynchro(); | |||
| fGraphManager = -1; | |||
| fEngineControl = -1; | |||
| } | |||
| @@ -68,8 +67,7 @@ struct JackLibGlobals | |||
| { | |||
| jack_log("~JackLibGlobals"); | |||
| for (int i = 0; i < CLIENT_NUM; i++) { | |||
| fSynchroTable[i]->Disconnect(); | |||
| delete fSynchroTable[i]; | |||
| fSynchroTable[i].Disconnect(); | |||
| } | |||
| JackMessageBuffer::Destroy(); | |||
| } | |||
| @@ -78,7 +76,6 @@ struct JackLibGlobals | |||
| { | |||
| if (fClientCount++ == 0 && !fGlobals) { | |||
| jack_log("JackLibGlobals Init %x", fGlobals); | |||
| JackGlobals::InitClient(); | |||
| InitTime(); | |||
| fGlobals = new JackLibGlobals(); | |||
| } | |||
| @@ -90,7 +87,6 @@ struct JackLibGlobals | |||
| jack_log("JackLibGlobals Destroy %x", fGlobals); | |||
| delete fGlobals; | |||
| fGlobals = NULL; | |||
| JackGlobals::Destroy(); | |||
| } | |||
| } | |||
| @@ -38,7 +38,7 @@ class JackLockedEngine : public JackEngineInterface, public JackLockAble | |||
| public: | |||
| JackLockedEngine(JackGraphManager* manager, JackSynchro** table, JackEngineControl* controler): | |||
| JackLockedEngine(JackGraphManager* manager, JackSynchro* table, JackEngineControl* controler): | |||
| fEngine(manager, table, controler) | |||
| {} | |||
| ~JackLockedEngine() | |||
| @@ -35,7 +35,7 @@ class JackLoopbackDriver : public JackAudioDriver | |||
| public: | |||
| JackLoopbackDriver(JackEngineInterface* engine, JackSynchro** table) | |||
| JackLoopbackDriver(JackEngineInterface* engine, JackSynchro* table) | |||
| : JackAudioDriver("loopback", "", engine, table) | |||
| {} | |||
| virtual ~JackLoopbackDriver() | |||
| @@ -40,11 +40,10 @@ namespace Jack | |||
| JackMessageBuffer* JackMessageBuffer::fInstance = NULL; | |||
| JackMessageBuffer::JackMessageBuffer():fInBuffer(0),fOutBuffer(0),fOverruns(0) | |||
| JackMessageBuffer::JackMessageBuffer() | |||
| :fThread(this),fInBuffer(0),fOutBuffer(0),fOverruns(0) | |||
| { | |||
| fThread = JackGlobals::MakeThread(this); | |||
| fSignal = JackGlobals::MakeInterProcessSync(); | |||
| fThread->StartSync(); | |||
| fThread.StartSync(); | |||
| } | |||
| JackMessageBuffer::~JackMessageBuffer() | |||
| @@ -54,12 +53,10 @@ JackMessageBuffer::~JackMessageBuffer() | |||
| } else { | |||
| jack_info("no message buffer overruns"); | |||
| } | |||
| fThread->SetStatus(JackThread::kIdle); | |||
| fSignal->Signal(); | |||
| fThread->Stop(); | |||
| fThread.SetStatus(JackThread::kIdle); | |||
| fSignal.Signal(); | |||
| fThread.Stop(); | |||
| Flush(); | |||
| delete fThread; | |||
| delete fSignal; | |||
| } | |||
| void JackMessageBuffer::Flush() | |||
| @@ -76,7 +73,7 @@ void JackMessageBuffer::AddMessage(int level, const char *message) | |||
| fBuffers[fInBuffer].level = level; | |||
| strncpy(fBuffers[fInBuffer].message, message, MB_BUFFERSIZE); | |||
| fInBuffer = MB_NEXT(fInBuffer); | |||
| fSignal->SignalAll(); | |||
| fSignal.SignalAll(); | |||
| fMutex.Unlock(); | |||
| } else { /* lock collision */ | |||
| INC_ATOMIC(&fOverruns); | |||
| @@ -85,7 +82,7 @@ void JackMessageBuffer::AddMessage(int level, const char *message) | |||
| bool JackMessageBuffer::Execute() | |||
| { | |||
| fSignal->Wait(); | |||
| fSignal.Wait(); | |||
| fMutex.Lock(); | |||
| Flush(); | |||
| fMutex.Unlock(); | |||
| @@ -30,10 +30,10 @@ | |||
| #ifndef __JackMessageBuffer__ | |||
| #define __JackMessageBuffer__ | |||
| #include "JackThread.h" | |||
| #include "JackPlatformThread.h" | |||
| #include "JackMutex.h" | |||
| #include "JackAtomic.h" | |||
| #include "JackSyncInterface.h" | |||
| #include "JackPlatformProcessSync.h" | |||
| namespace Jack | |||
| { | |||
| @@ -56,8 +56,8 @@ class JackMessageBuffer : public JackRunnableInterface | |||
| JackMessage fBuffers[MB_BUFFERS]; | |||
| JackMutex fMutex; | |||
| JackThread* fThread; | |||
| JackSyncInterface* fSignal; | |||
| JackThread fThread; | |||
| JackProcessSync fSignal; | |||
| volatile unsigned int fInBuffer; | |||
| volatile unsigned int fOutBuffer; | |||
| SInt32 fOverruns; | |||
| @@ -0,0 +1,59 @@ | |||
| /* | |||
| Copyright (C) 2004-2008 Grame | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU General Public License as published by | |||
| the Free Software Foundation; either version 2 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU General Public License for more details. | |||
| You should have received a copy of the GNU General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| #ifndef __JackPlatformClientChannel__ | |||
| #define __JackPlatformClientChannel___ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "config.h" | |||
| #endif | |||
| // OSX | |||
| #if defined(__APPLE__) | |||
| #include "JackMachClientChannel.h" | |||
| #endif | |||
| // WINDOWS | |||
| #ifdef WIN32 | |||
| #include "JackWinNamedPipeClientChannel.h" | |||
| #endif | |||
| // LINUX | |||
| #ifdef __linux__ | |||
| #include "JackSocketClientChannel.h" | |||
| #endif | |||
| namespace Jack | |||
| { | |||
| #ifdef WIN32 | |||
| typedef JackWinNamedPipeClientChannel JackClientChannel; | |||
| #elif defined(SOCKET_RPC_POSIX_SEMA) || defined(SOCKET_RPC_FIFO_SEMA) || defined(SOCKET_RPC_FIFO_SEMA_DUMMY) \ | |||
| || defined(SOCKET_RPC_MACH_SEMA) | |||
| typedef JackSocketClientChannel JackClientChannel; | |||
| #elif defined(MACH_RPC_MACH_SEMA) || defined(MACH_RPC_FIFO_SEMA) || defined(MACH_RPC_POSIX_SEMA) | |||
| typedef JackMachClientChannel JackClientChannel; | |||
| #endif | |||
| } // end of namespace | |||
| #endif /* __JackPlatformClientChannel__ */ | |||
| @@ -0,0 +1,59 @@ | |||
| /* | |||
| Copyright (C) 2004-2008 Grame | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU General Public License as published by | |||
| the Free Software Foundation; either version 2 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU General Public License for more details. | |||
| You should have received a copy of the GNU General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| #ifndef __JackPlatformNotifyChannel__ | |||
| #define __JackPlatformNotifyChannel__ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "config.h" | |||
| #endif | |||
| // OSX | |||
| #if defined(__APPLE__) | |||
| #include "JackMachNotifyChannel.h" | |||
| #endif | |||
| // WINDOWS | |||
| #ifdef WIN32 | |||
| #include "JackWinNamedPipeNotifyChannel.h" | |||
| #endif | |||
| // LINUX | |||
| #ifdef __linux__ | |||
| #include "JackSocketNotifyChannel.h" | |||
| #endif | |||
| namespace Jack | |||
| { | |||
| #ifdef WIN32 | |||
| typedef JackWinNamedPipeNotifyChannel JackNotifyChannel; | |||
| #elif defined(SOCKET_RPC_POSIX_SEMA) || defined(SOCKET_RPC_FIFO_SEMA) || defined(SOCKET_RPC_FIFO_SEMA_DUMMY) \ | |||
| || defined(SOCKET_RPC_MACH_SEMA) | |||
| typedef JackSocketNotifyChannel JackNotifyChannel; | |||
| #elif defined(MACH_RPC_MACH_SEMA) || defined(MACH_RPC_FIFO_SEMA) || defined(MACH_RPC_POSIX_SEMA) | |||
| typedef JackMachNotifyChannel JackNotifyChannel; | |||
| #endif | |||
| } // end of namespace | |||
| #endif /* __JackPlatformNotifyChannel__ */ | |||
| @@ -0,0 +1,51 @@ | |||
| /* | |||
| Copyright (C) 2004-2008 Grame | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU General Public License as published by | |||
| the Free Software Foundation; either version 2 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU General Public License for more details. | |||
| You should have received a copy of the GNU General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| #ifndef __JackPlatformProcessSync__ | |||
| #define __JackPlatformProcessSync__ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "config.h" | |||
| #endif | |||
| // OSX | |||
| #if defined(__APPLE__) | |||
| #include "JackProcessSync.h" | |||
| #endif | |||
| // WINDOWS | |||
| #ifdef WIN32 | |||
| #include "JackWinProcessSync.h" | |||
| #endif | |||
| // LINUX | |||
| #ifdef __linux__ | |||
| #include "JackProcessSync.h" | |||
| #endif | |||
| namespace Jack | |||
| { | |||
| #ifdef WIN32 | |||
| typedef JackWinProcessSync JackProcessSync; | |||
| #endif | |||
| } // end of namespace | |||
| #endif /* __JackPlatformProcessSync__ */ | |||
| @@ -0,0 +1,59 @@ | |||
| /* | |||
| Copyright (C) 2004-2008 Grame | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU General Public License as published by | |||
| the Free Software Foundation; either version 2 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU General Public License for more details. | |||
| You should have received a copy of the GNU General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| #ifndef __JackPlatformServerChannel__ | |||
| #define __JackPlatformServerChannel___ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "config.h" | |||
| #endif | |||
| // OSX | |||
| #if defined(__APPLE__) | |||
| #include "JackMachServerChannel.h" | |||
| #endif | |||
| // WINDOWS | |||
| #ifdef WIN32 | |||
| #include "JackWinNamedPipeServerChannel.h" | |||
| #endif | |||
| // LINUX | |||
| #ifdef __linux__ | |||
| #include "JackSocketServerChannel.h" | |||
| #endif | |||
| namespace Jack | |||
| { | |||
| #ifdef WIN32 | |||
| typedef JackWinNamedPipeServerChannel JackServerChannel; | |||
| #elif defined(SOCKET_RPC_POSIX_SEMA) || defined(SOCKET_RPC_FIFO_SEMA) || defined(SOCKET_RPC_FIFO_SEMA_DUMMY) \ | |||
| || defined(SOCKET_RPC_MACH_SEMA) | |||
| typedef JackSocketServerChannel JackServerChannel; | |||
| #elif defined(MACH_RPC_MACH_SEMA) || defined(MACH_RPC_FIFO_SEMA) || defined(MACH_RPC_POSIX_SEMA) | |||
| typedef JackMachServerChannel JackServerChannel; | |||
| #endif | |||
| } // end of namespace | |||
| #endif /* __JackPlatformServerChannel__ */ | |||
| @@ -0,0 +1,59 @@ | |||
| /* | |||
| Copyright (C) 2004-2008 Grame | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU General Public License as published by | |||
| the Free Software Foundation; either version 2 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU General Public License for more details. | |||
| You should have received a copy of the GNU General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| #ifndef __JackPlatformServerNotifyChannel__ | |||
| #define __JackPlatformServerNotifyChannel___ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "config.h" | |||
| #endif | |||
| // OSX | |||
| #if defined(__APPLE__) | |||
| #include "JackMachServerNotifyChannel.h" | |||
| #endif | |||
| // WINDOWS | |||
| #ifdef WIN32 | |||
| #include "JackWinNamedPipeServerNotifyChannel.h" | |||
| #endif | |||
| // LINUX | |||
| #ifdef __linux__ | |||
| #include "JackSocketServerNotifyChannel.h" | |||
| #endif | |||
| namespace Jack | |||
| { | |||
| #ifdef WIN32 | |||
| typedef JackWinNamedPipeServerNotifyChannel JackServerNotifyChannel; | |||
| #elif defined(SOCKET_RPC_POSIX_SEMA) || defined(SOCKET_RPC_FIFO_SEMA) || defined(SOCKET_RPC_FIFO_SEMA_DUMMY) \ | |||
| || defined(SOCKET_RPC_MACH_SEMA) | |||
| typedef JackSocketServerNotifyChannel JackServerNotifyChannel; | |||
| #elif defined(MACH_RPC_MACH_SEMA) || defined(MACH_RPC_FIFO_SEMA) || defined(MACH_RPC_POSIX_SEMA) | |||
| typedef JackMachServerNotifyChannel JackServerNotifyChannel; | |||
| #endif | |||
| } // end of namespace | |||
| #endif /* __JackPlatformServerNotifyChannel__ */ | |||
| @@ -0,0 +1,64 @@ | |||
| /* | |||
| Copyright (C) 2004-2008 Grame | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU General Public License as published by | |||
| the Free Software Foundation; either version 2 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU General Public License for more details. | |||
| You should have received a copy of the GNU General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| #ifndef __JackPlatformSynchro__ | |||
| #define __JackPlatformSynchro__ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "config.h" | |||
| #endif | |||
| // OSX | |||
| #if defined(__APPLE__) | |||
| #include "JackMachSemaphore.h" | |||
| #endif | |||
| // WINDOWS | |||
| #ifdef WIN32 | |||
| #include "JackWinSemaphore.h" | |||
| #endif | |||
| // LINUX | |||
| #ifdef __linux__ | |||
| #include "JackPosixSemaphore.h" | |||
| #include "JackFifo.h" | |||
| #endif | |||
| namespace Jack | |||
| { | |||
| #ifdef WIN32 | |||
| typedef JackWinSemaphore JackSynchro; | |||
| #endif | |||
| #if defined(MACH_RPC_MACH_SEMA) || defined(SOCKET_RPC_MACH_SEMA) | |||
| typedef JackMachSemaphore JackSynchro; | |||
| #endif | |||
| #if defined(SOCKET_RPC_POSIX_SEMA) || defined(MACH_RPC_POSIX_SEMA) | |||
| typedef JackPosixSemaphore JackSynchro; | |||
| #endif | |||
| #if defined(SOCKET_RPC_FIFO_SEMA) || defined(SOCKET_RPC_FIFO_SEMA_DUMMY) || defined(MACH_RPC_FIFO_SEMA) | |||
| typedef JackFifo JackSynchro; | |||
| #endif | |||
| } // end of namespace | |||
| #endif /* __JackPlatformSynchro__ */ | |||
| @@ -0,0 +1,59 @@ | |||
| /* | |||
| Copyright (C) 2004-2008 Grame | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU General Public License as published by | |||
| the Free Software Foundation; either version 2 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU General Public License for more details. | |||
| You should have received a copy of the GNU General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| #ifndef __JackPlatformThread__ | |||
| #define __JackPlatformThread__ | |||
| #ifdef HAVE_CONFIG_H | |||
| #include "config.h" | |||
| #endif | |||
| // OSX | |||
| #if defined(__APPLE__) | |||
| #include "JackMachThread.h" | |||
| #endif | |||
| // WINDOWS | |||
| #ifdef WIN32 | |||
| #include "JackWinThread.h" | |||
| #endif | |||
| // LINUX | |||
| #ifdef __linux__ | |||
| #include "JackPosixThread.h" | |||
| #endif | |||
| namespace Jack | |||
| { | |||
| #ifdef WIN32 | |||
| typedef JackWinThread JackThread; | |||
| #endif | |||
| #ifdef __linux__ | |||
| typedef JackPosixThread JackThread; | |||
| #endif | |||
| #if defined(__APPLE__) | |||
| typedef JackMachThread JackThread; | |||
| #endif | |||
| } // end of namespace | |||
| #endif /* __JackPlatformThread__ */ | |||
| @@ -33,7 +33,7 @@ namespace Jack | |||
| \brief Inter process synchronization using POSIX semaphore. | |||
| */ | |||
| class JackPosixSemaphore : public JackSynchro | |||
| class JackPosixSemaphore : public detail::JackSynchro | |||
| { | |||
| private: | |||
| @@ -46,9 +46,7 @@ class JackPosixSemaphore : public JackSynchro | |||
| public: | |||
| JackPosixSemaphore(): JackSynchro(), fSemaphore(NULL) | |||
| {} | |||
| virtual ~JackPosixSemaphore() | |||
| JackPosixSemaphore(): fSemaphore(NULL) | |||
| {} | |||
| bool Signal(); | |||
| @@ -35,7 +35,7 @@ namespace Jack | |||
| \brief The POSIX thread base class. | |||
| */ | |||
| class JackPosixThread : public JackThread | |||
| class JackPosixThread : public detail::JackThread | |||
| { | |||
| protected: | |||
| @@ -48,25 +48,19 @@ class JackPosixThread : public JackThread | |||
| JackPosixThread(JackRunnableInterface* runnable, bool real_time, int priority, int cancellation) | |||
| : JackThread(runnable, priority, real_time, cancellation), fThread((pthread_t)NULL) | |||
| {} | |||
| JackPosixThread(JackRunnableInterface* runnable) | |||
| : JackThread(runnable, 0, false, PTHREAD_CANCEL_DEFERRED), fThread((pthread_t)NULL) | |||
| {} | |||
| JackPosixThread(JackRunnableInterface* runnable, int cancellation) | |||
| JackPosixThread(JackRunnableInterface* runnable, int cancellation = PTHREAD_CANCEL_ASYNCHRONOUS) | |||
| : JackThread(runnable, 0, false, cancellation), fThread((pthread_t)NULL) | |||
| {} | |||
| virtual ~JackPosixThread() | |||
| {} | |||
| virtual int Start(); | |||
| virtual int StartSync(); | |||
| virtual int Kill(); | |||
| virtual int Stop(); | |||
| virtual void Terminate(); | |||
| int Start(); | |||
| int StartSync(); | |||
| int Kill(); | |||
| int Stop(); | |||
| void Terminate(); | |||
| virtual int AcquireRealTime(); | |||
| virtual int AcquireRealTime(int priority); | |||
| virtual int DropRealTime(); | |||
| int AcquireRealTime(); | |||
| int AcquireRealTime(int priority); | |||
| int DropRealTime(); | |||
| pthread_t GetThreadID(); | |||
| @@ -20,8 +20,7 @@ This program is free software; you can redistribute it and/or modify | |||
| #ifndef __JackProcessSync__ | |||
| #define __JackProcessSync__ | |||
| #include "JackSyncInterface.h" | |||
| #include "JackSynchro.h" | |||
| #include "JackPlatformSynchro.h" | |||
| #include <pthread.h> | |||
| #include <sys/time.h> | |||
| #include <unistd.h> | |||
| @@ -33,7 +32,7 @@ namespace Jack | |||
| \brief A synchronization primitive built using a condition variable. | |||
| */ | |||
| class JackProcessSync : public JackSyncInterface | |||
| class JackProcessSync | |||
| { | |||
| private: | |||
| @@ -43,12 +42,13 @@ class JackProcessSync : public JackSyncInterface | |||
| public: | |||
| JackProcessSync(): JackSyncInterface() | |||
| JackProcessSync() | |||
| { | |||
| pthread_mutex_init(&fLock, NULL); | |||
| pthread_cond_init(&fCond, NULL); | |||
| } | |||
| virtual ~JackProcessSync() | |||
| ~JackProcessSync() | |||
| { | |||
| pthread_mutex_destroy(&fLock); | |||
| pthread_cond_destroy(&fCond); | |||
| @@ -91,7 +91,7 @@ class JackProcessSync : public JackSyncInterface | |||
| \brief A synchronization primitive built using an inter-process synchronization object. | |||
| */ | |||
| class JackInterProcessSync : public JackSyncInterface | |||
| class JackInterProcessSync | |||
| { | |||
| private: | |||
| @@ -102,7 +102,7 @@ class JackInterProcessSync : public JackSyncInterface | |||
| JackInterProcessSync(JackSynchro* synchro): fSynchro(synchro) | |||
| {} | |||
| virtual ~JackInterProcessSync() | |||
| ~JackInterProcessSync() | |||
| { | |||
| delete fSynchro; | |||
| } | |||
| @@ -37,7 +37,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #include "JackChannel.h" | |||
| #include "JackClientControl.h" | |||
| #include "JackEngineControl.h" | |||
| #include "JackSyncInterface.h" | |||
| #include "JackGraphManager.h" | |||
| #include "JackInternalClient.h" | |||
| #include "JackError.h" | |||
| @@ -50,14 +49,11 @@ JackServer* JackServer::fInstance = NULL; | |||
| JackServer::JackServer(bool sync, bool temporary, long timeout, bool rt, long priority, long loopback, bool verbose, const char* server_name) | |||
| { | |||
| for (int i = 0; i < CLIENT_NUM; i++) | |||
| fSynchroTable[i] = JackGlobals::MakeSynchro(); | |||
| fGraphManager = new JackGraphManager(); | |||
| fEngineControl = new JackEngineControl(sync, temporary, timeout, rt, priority, verbose, server_name); | |||
| fEngine = new JackLockedEngine(fGraphManager, fSynchroTable, fEngineControl); | |||
| fFreewheelDriver = new JackThreadedDriver(new JackFreewheelDriver(fEngine, fSynchroTable)); | |||
| fLoopbackDriver = new JackLoopbackDriver(fEngine, fSynchroTable); | |||
| fChannel = JackGlobals::MakeServerChannel(); | |||
| fEngine = new JackLockedEngine(fGraphManager, GetSynchroTable(), fEngineControl); | |||
| fFreewheelDriver = new JackThreadedDriver(new JackFreewheelDriver(fEngine, GetSynchroTable())); | |||
| fLoopbackDriver = new JackLoopbackDriver(fEngine, GetSynchroTable()); | |||
| fFreewheel = false; | |||
| fLoopback = loopback; | |||
| fDriverInfo = NULL; | |||
| @@ -68,14 +64,11 @@ JackServer::JackServer(bool sync, bool temporary, long timeout, bool rt, long pr | |||
| JackServer::~JackServer() | |||
| { | |||
| for (int i = 0; i < CLIENT_NUM; i++) | |||
| delete fSynchroTable[i]; | |||
| delete fGraphManager; | |||
| delete fAudioDriver; | |||
| delete fFreewheelDriver; | |||
| delete fLoopbackDriver; | |||
| delete fEngine; | |||
| delete fChannel; | |||
| delete fEngineControl; | |||
| if (fDriverInfo) { | |||
| UnloadDriverModule(fDriverInfo->handle); | |||
| @@ -90,7 +83,7 @@ int JackServer::Open(jack_driver_desc_t* driver_desc, JSList* driver_params) | |||
| // TODO: move that in reworked JackServerGlobals::Init() | |||
| JackMessageBuffer::Create(); | |||
| if (fChannel->Open(fEngineControl->fServerName, this) < 0) { | |||
| if (fChannel.Open(fEngineControl->fServerName, this) < 0) { | |||
| jack_error("Server channel open error"); | |||
| return -1; | |||
| } | |||
| @@ -104,7 +97,7 @@ int JackServer::Open(jack_driver_desc_t* driver_desc, JSList* driver_params) | |||
| return -1; | |||
| } | |||
| if ((fAudioDriver = fDriverInfo->initialize(fEngine, fSynchroTable, driver_params)) == NULL) { | |||
| if ((fAudioDriver = fDriverInfo->initialize(fEngine, GetSynchroTable(), driver_params)) == NULL) { | |||
| jack_error("Cannot initialize driver"); | |||
| return -1; | |||
| } | |||
| @@ -142,7 +135,7 @@ int JackServer::Open(jack_driver_desc_t* driver_desc, JSList* driver_params) | |||
| int JackServer::Close() | |||
| { | |||
| jack_log("JackServer::Close"); | |||
| fChannel->Close(); | |||
| fChannel.Close(); | |||
| fAudioDriver->Detach(); | |||
| if (fLoopback > 0) | |||
| fLoopbackDriver->Detach(); | |||
| @@ -303,7 +296,7 @@ JackEngineInterface* JackServer::GetEngine() | |||
| return fEngine; | |||
| } | |||
| JackSynchro** JackServer::GetSynchroTable() | |||
| JackSynchro* JackServer::GetSynchroTable() | |||
| { | |||
| return fSynchroTable; | |||
| } | |||
| @@ -28,14 +28,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| #include "jslist.h" | |||
| #include "JackGlobals.h" | |||
| #include "JackPlatformSynchro.h" | |||
| #include "JackPlatformSynchro.h" | |||
| #include "JackPlatformServerChannel.h" | |||
| namespace Jack | |||
| { | |||
| class JackGraphManager; | |||
| class JackDriverClientInterface; | |||
| class JackServerChannelInterface; | |||
| class JackSyncInterface; | |||
| struct JackEngineControl; | |||
| class JackEngineInterface; | |||
| @@ -43,7 +45,7 @@ class JackEngineInterface; | |||
| \brief The Jack server. | |||
| */ | |||
| class EXPORT JackServer : private detail::JackGlobalsServerInitializer | |||
| class EXPORT JackServer | |||
| { | |||
| private: | |||
| @@ -55,9 +57,9 @@ class EXPORT JackServer : private detail::JackGlobalsServerInitializer | |||
| JackEngineInterface* fEngine; | |||
| JackEngineControl* fEngineControl; | |||
| JackGraphManager* fGraphManager; | |||
| JackServerChannelInterface* fChannel; | |||
| JackServerChannel fChannel; | |||
| JackConnectionManager fConnectionState; | |||
| JackSynchro* fSynchroTable[CLIENT_NUM]; | |||
| JackSynchro fSynchroTable[CLIENT_NUM]; | |||
| bool fFreewheel; | |||
| long fLoopback; | |||
| @@ -88,7 +90,7 @@ class EXPORT JackServer : private detail::JackGlobalsServerInitializer | |||
| // Object access | |||
| JackEngineInterface* GetEngine(); | |||
| JackEngineControl* GetEngineControl(); | |||
| JackSynchro** GetSynchroTable(); | |||
| JackSynchro* GetSynchroTable(); | |||
| JackGraphManager* GetGraphManager(); | |||
| static JackServer* fInstance; // Unique instance | |||
| @@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #include "JackChannel.h" | |||
| #include "JackLibGlobals.h" | |||
| #include "JackServerLaunch.h" | |||
| #include "JackPlatformClientChannel.h" | |||
| using namespace Jack; | |||
| @@ -210,10 +211,9 @@ int start_server(const char* server_name, jack_options_t options) | |||
| int server_connect(char* server_name) | |||
| { | |||
| JackClientChannelInterface* channel = JackGlobals::MakeClientChannel(); | |||
| int res = channel->ServerCheck(server_name); | |||
| channel->Close(); | |||
| delete channel; | |||
| JackClientChannel channel; | |||
| int res = channel.ServerCheck(server_name); | |||
| channel.Close(); | |||
| return res; | |||
| } | |||
| @@ -29,16 +29,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| namespace Jack | |||
| { | |||
| JackSocketClientChannel::JackSocketClientChannel() | |||
| JackSocketClientChannel::JackSocketClientChannel(): | |||
| fThread(this) | |||
| { | |||
| fThread = JackGlobals::MakeThread(this); | |||
| fNotificationSocket = NULL; | |||
| fClient = NULL; | |||
| } | |||
| JackSocketClientChannel::~JackSocketClientChannel() | |||
| { | |||
| delete fThread; | |||
| delete fNotificationSocket; | |||
| } | |||
| @@ -105,7 +104,7 @@ int JackSocketClientChannel::Start() | |||
| /* | |||
| To be sure notification thread is started before ClientOpen is called. | |||
| */ | |||
| if (fThread->StartSync() != 0) { | |||
| if (fThread.StartSync() != 0) { | |||
| jack_error("Cannot start Jack client listener"); | |||
| return -1; | |||
| } else { | |||
| @@ -113,10 +112,11 @@ int JackSocketClientChannel::Start() | |||
| } | |||
| } | |||
| void JackSocketClientChannel::Stop() | |||
| { | |||
| jack_log("JackSocketClientChannel::Stop"); | |||
| fThread->Kill(); | |||
| fThread.Kill(); | |||
| } | |||
| void JackSocketClientChannel::ServerSyncCall(JackRequest* req, JackResult* res, int* result) | |||
| @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #include "JackChannel.h" | |||
| #include "JackSocket.h" | |||
| #include "JackThread.h" | |||
| #include "JackPlatformThread.h" | |||
| #include "JackRequest.h" | |||
| namespace Jack | |||
| @@ -32,7 +32,7 @@ namespace Jack | |||
| \brief JackClientChannel using sockets. | |||
| */ | |||
| class JackSocketClientChannel : public JackClientChannelInterface, public JackRunnableInterface | |||
| class JackSocketClientChannel : public detail::JackClientChannelInterface, public JackRunnableInterface | |||
| { | |||
| private: | |||
| @@ -40,7 +40,7 @@ class JackSocketClientChannel : public JackClientChannelInterface, public JackRu | |||
| JackClientSocket fRequestSocket; // Socket to communicate with the server | |||
| JackServerSocket fNotificationListenSocket; // Socket listener for server notification | |||
| JackClientSocket* fNotificationSocket; // Socket for server notification | |||
| JackThread* fThread; // Thread to execute the event loop | |||
| JackThread fThread; // Thread to execute the event loop | |||
| JackClient* fClient; | |||
| void ServerSyncCall(JackRequest* req, JackResult* res, int* result); | |||
| @@ -61,6 +61,8 @@ class JackSocketClientChannel : public JackClientChannelInterface, public JackRu | |||
| void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result); | |||
| void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result) | |||
| {} | |||
| void ClientClose(int refnum, int* result); | |||
| void ClientActivate(int refnum, int state, int* result); | |||
| @@ -30,7 +30,7 @@ namespace Jack | |||
| \brief JackNotifyChannel using sockets. | |||
| */ | |||
| class JackSocketNotifyChannel : public JackNotifyChannelInterface | |||
| class JackSocketNotifyChannel | |||
| { | |||
| private: | |||
| @@ -41,8 +41,6 @@ class JackSocketNotifyChannel : public JackNotifyChannelInterface | |||
| JackSocketNotifyChannel() | |||
| {} | |||
| virtual ~JackSocketNotifyChannel() | |||
| {} | |||
| int Open(const char* name); // Open the Server/Client connection | |||
| void Close(); // Close the Server/Client connection | |||
| @@ -35,16 +35,15 @@ using namespace std; | |||
| namespace Jack | |||
| { | |||
| JackSocketServerChannel::JackSocketServerChannel() | |||
| JackSocketServerChannel::JackSocketServerChannel(): | |||
| fThread(this) | |||
| { | |||
| fThread = JackGlobals::MakeThread(this); | |||
| fPollTable = NULL; | |||
| fRebuild = true; | |||
| } | |||
| JackSocketServerChannel::~JackSocketServerChannel() | |||
| { | |||
| delete fThread; | |||
| delete[] fPollTable; | |||
| } | |||
| @@ -63,7 +62,7 @@ int JackSocketServerChannel::Open(const char* server_name, JackServer* server) | |||
| BuildPoolTable(); | |||
| // Start listening | |||
| if (fThread->Start() != 0) { | |||
| if (fThread.Start() != 0) { | |||
| jack_error("Cannot start Jack server listener"); | |||
| goto error; | |||
| } | |||
| @@ -77,7 +76,7 @@ error: | |||
| void JackSocketServerChannel::Close() | |||
| { | |||
| fThread->Kill(); | |||
| fThread.Kill(); | |||
| fRequestListenSocket.Close(); | |||
| } | |||
| @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #include "JackChannel.h" | |||
| #include "JackSocket.h" | |||
| #include "JackThread.h" | |||
| #include "JackPlatformThread.h" | |||
| #include <poll.h> | |||
| #include <map> | |||
| @@ -33,13 +33,13 @@ namespace Jack | |||
| \brief JackServerChannel using sockets. | |||
| */ | |||
| class JackSocketServerChannel : public JackServerChannelInterface, public JackRunnableInterface | |||
| class JackSocketServerChannel : public JackRunnableInterface | |||
| { | |||
| private: | |||
| JackServerSocket fRequestListenSocket; // Socket to create request socket for the client | |||
| JackThread* fThread; // Thread to execute the event loop | |||
| JackThread fThread; // Thread to execute the event loop | |||
| JackServer* fServer; | |||
| pollfd* fPollTable; | |||
| bool fRebuild; | |||
| @@ -56,7 +56,7 @@ class JackSocketServerChannel : public JackServerChannelInterface, public JackRu | |||
| public: | |||
| JackSocketServerChannel(); | |||
| virtual ~JackSocketServerChannel(); | |||
| ~JackSocketServerChannel(); | |||
| int Open(const char* server_name, JackServer* server); // Open the Server/Client connection | |||
| void Close(); // Close the Server/Client connection | |||
| @@ -30,7 +30,7 @@ namespace Jack | |||
| \brief JackServerNotifyChannel using sockets. | |||
| */ | |||
| class JackSocketServerNotifyChannel : public JackServerNotifyChannelInterface | |||
| class JackSocketServerNotifyChannel | |||
| { | |||
| private: | |||
| @@ -40,8 +40,6 @@ class JackSocketServerNotifyChannel : public JackServerNotifyChannelInterface | |||
| JackSocketServerNotifyChannel() | |||
| {} | |||
| virtual ~JackSocketServerNotifyChannel() | |||
| {} | |||
| int Open(const char* server_name); | |||
| void Close(); | |||
| @@ -1,52 +0,0 @@ | |||
| /* | |||
| Copyright (C) 2004-2006 Grame | |||
| This program is free software; you can redistribute it and/or modify | |||
| it under the terms of the GNU General Public License as published by | |||
| the Free Software Foundation; either version 2 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU General Public License for more details. | |||
| You should have received a copy of the GNU General Public License | |||
| along with this program; if not, write to the Free Software | |||
| Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| */ | |||
| #ifndef __JackSyncInterface__ | |||
| #define __JackSyncInterface__ | |||
| namespace Jack | |||
| { | |||
| /*! | |||
| \brief A synchronization primitive interface. | |||
| */ | |||
| class JackSyncInterface | |||
| { | |||
| public: | |||
| JackSyncInterface() | |||
| {} | |||
| virtual ~JackSyncInterface() | |||
| {} | |||
| virtual bool Allocate(const char* name) = 0; | |||
| virtual bool Connect(const char* name) = 0; | |||
| virtual bool TimedWait(long usec) = 0; | |||
| virtual void Wait() = 0; | |||
| virtual void Signal() = 0; | |||
| virtual void SignalAll() = 0; | |||
| virtual void Destroy() = 0; | |||
| }; | |||
| } // end of namespace | |||
| #endif | |||
| @@ -28,6 +28,8 @@ namespace Jack | |||
| /*! | |||
| \brief An inter process synchronization primitive. | |||
| */ | |||
| namespace detail | |||
| { | |||
| class JackSynchro | |||
| { | |||
| @@ -37,53 +39,53 @@ class JackSynchro | |||
| char fName[SYNC_MAX_NAME_SIZE]; | |||
| bool fFlush; // If true, signal are "flushed" : used for drivers that do no consume the signal | |||
| virtual void BuildName(const char* name, const char* server_name, char* res) | |||
| void BuildName(const char* name, const char* server_name, char* res) | |||
| {} | |||
| public: | |||
| JackSynchro(): fFlush(false) | |||
| {} | |||
| virtual ~JackSynchro() | |||
| ~JackSynchro() | |||
| {} | |||
| virtual bool Signal() | |||
| bool Signal() | |||
| { | |||
| return true; | |||
| } | |||
| virtual bool SignalAll() | |||
| bool SignalAll() | |||
| { | |||
| return true; | |||
| } | |||
| virtual bool Wait() | |||
| bool Wait() | |||
| { | |||
| return true; | |||
| } | |||
| virtual bool TimedWait(long usec) | |||
| bool TimedWait(long usec) | |||
| { | |||
| return true; | |||
| } | |||
| virtual bool Allocate(const char* name, const char* server_name, int value) | |||
| bool Allocate(const char* name, const char* server_name, int value) | |||
| { | |||
| return true; | |||
| } | |||
| virtual bool Connect(const char* name, const char* server_name) | |||
| bool Connect(const char* name, const char* server_name) | |||
| { | |||
| return true; | |||
| } | |||
| virtual bool ConnectInput(const char* name, const char* server_name) | |||
| bool ConnectInput(const char* name, const char* server_name) | |||
| { | |||
| return true; | |||
| } | |||
| virtual bool ConnectOutput(const char* name, const char* server_name) | |||
| bool ConnectOutput(const char* name, const char* server_name) | |||
| { | |||
| return true; | |||
| } | |||
| virtual bool Disconnect() | |||
| bool Disconnect() | |||
| { | |||
| return true; | |||
| } | |||
| virtual void Destroy() | |||
| void Destroy() | |||
| {} | |||
| void SetFlush(bool mode) | |||
| @@ -92,7 +94,7 @@ class JackSynchro | |||
| } | |||
| }; | |||
| } | |||
| } // end of namespace | |||
| @@ -58,6 +58,8 @@ class JackRunnableInterface | |||
| \brief The thread base class. | |||
| */ | |||
| namespace detail | |||
| { | |||
| class JackThread | |||
| { | |||
| public: | |||
| @@ -77,35 +79,24 @@ class JackThread | |||
| JackThread(JackRunnableInterface* runnable, int priority, bool real_time, int cancellation): | |||
| fRunnable(runnable), fPriority(priority), fRealTime(real_time), fStatus(kIdle), fCancellation(cancellation) | |||
| {} | |||
| virtual ~JackThread() | |||
| {} | |||
| virtual int Start() = 0; | |||
| virtual int StartSync() = 0; | |||
| virtual int Kill() = 0; | |||
| virtual int Stop() = 0; | |||
| virtual void Terminate() = 0; | |||
| virtual int AcquireRealTime() = 0; | |||
| virtual int AcquireRealTime(int priority) = 0; | |||
| virtual int DropRealTime() = 0; | |||
| virtual kThreadState GetStatus() | |||
| kThreadState GetStatus() | |||
| { | |||
| return fStatus; | |||
| } | |||
| virtual void SetStatus(kThreadState status) | |||
| void SetStatus(kThreadState status) | |||
| { | |||
| fStatus = status; | |||
| } | |||
| virtual void SetParams(UInt64 period, UInt64 computation, UInt64 constraint) // Empty implementation, will only make sense on OSX... | |||
| void SetParams(UInt64 period, UInt64 computation, UInt64 constraint) // Empty implementation, will only make sense on OSX... | |||
| {} | |||
| virtual pthread_t GetThreadID() = 0; | |||
| }; | |||
| } | |||
| } // end of namespace | |||
| #if defined(WIN32) | |||
| @@ -36,15 +36,14 @@ | |||
| namespace Jack | |||
| { | |||
| JackThreadedDriver::JackThreadedDriver(JackDriverClient* driver) | |||
| JackThreadedDriver::JackThreadedDriver(JackDriverClient* driver): | |||
| fThread(this) | |||
| { | |||
| fThread = JackGlobals::MakeThread(this); | |||
| fDriver = driver; | |||
| } | |||
| JackThreadedDriver::~JackThreadedDriver() | |||
| { | |||
| delete fThread; | |||
| delete fDriver; | |||
| } | |||
| @@ -56,7 +55,7 @@ int JackThreadedDriver::Start() | |||
| jack_error("Cannot start driver"); | |||
| return -1; | |||
| } | |||
| if (fThread->Start() < 0) { | |||
| if (fThread.Start() < 0) { | |||
| jack_error("Cannot start thread"); | |||
| return -1; | |||
| } | |||
| @@ -68,12 +67,12 @@ int JackThreadedDriver::Stop() | |||
| { | |||
| jack_log("JackThreadedDriver::Stop"); | |||
| switch (fThread->GetStatus()) { | |||
| switch (fThread.GetStatus()) { | |||
| // Kill the thread in Init phase | |||
| case JackThread::kStarting: | |||
| case JackThread::kIniting: | |||
| if (fThread->Kill() < 0) { | |||
| if (fThread.Kill() < 0) { | |||
| jack_error("Cannot kill thread"); | |||
| return -1; | |||
| } | |||
| @@ -81,7 +80,7 @@ int JackThreadedDriver::Stop() | |||
| // Stop when the thread cycle is finished | |||
| case JackThread::kRunning: | |||
| if (fThread->Stop() < 0) { | |||
| if (fThread.Stop() < 0) { | |||
| jack_error("Cannot stop thread"); | |||
| return -1; | |||
| } | |||
| @@ -109,8 +108,8 @@ bool JackThreadedDriver::Init() | |||
| if (fDriver->IsRealTime()) { | |||
| jack_log("JackThreadedDriver::Init IsRealTime"); | |||
| // Will do "something" on OSX only... | |||
| fThread->SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint); | |||
| if (fThread->AcquireRealTime(GetEngineControl()->fPriority) < 0) | |||
| fThread.SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint); | |||
| if (fThread.AcquireRealTime(GetEngineControl()->fPriority) < 0) | |||
| jack_error("AcquireRealTime error"); | |||
| } | |||
| return true; | |||
| @@ -123,14 +122,14 @@ bool JackRestartThreadedDriver::Execute() | |||
| { | |||
| try { | |||
| // Keep running even in case of error | |||
| while (fThread->GetStatus() == JackThread::kRunning) { | |||
| while (fThread.GetStatus() == JackThread::kRunning) { | |||
| Process(); | |||
| } | |||
| } catch (JackDriverException e) { | |||
| e.PrintMessage(); | |||
| jack_log("Driver is restarted"); | |||
| fThread->SetStatus(JackThread::kIniting); | |||
| fThread->DropRealTime(); | |||
| fThread.SetStatus(JackThread::kIniting); | |||
| fThread.DropRealTime(); | |||
| return Init(); | |||
| } | |||
| return false; | |||
| @@ -22,7 +22,7 @@ | |||
| #define __JackThreadedDriver__ | |||
| #include "JackDriver.h" | |||
| #include "JackThread.h" | |||
| #include "JackPlatformThread.h" | |||
| namespace Jack | |||
| { | |||
| @@ -36,7 +36,7 @@ class JackThreadedDriver : public JackDriverClientInterface, public JackRunnable | |||
| protected: | |||
| JackThread* fThread; | |||
| JackThread fThread; | |||
| JackDriverClient* fDriver; | |||
| public: | |||
| @@ -80,7 +80,6 @@ srcfiles_common_serverlib = [ | |||
| 'JackExternalClient.cpp', | |||
| 'JackFrameTimer.cpp', | |||
| 'JackFreewheelDriver.cpp', | |||
| 'JackGlobalsServer.cpp', | |||
| 'JackGraphManager.cpp', | |||
| 'JackInternalClient.cpp', | |||
| 'JackPort.cpp', | |||
| @@ -107,7 +106,6 @@ srcfiles_common_serverlib = [ | |||
| 'JackDebugClient.cpp', | |||
| 'JackTransportEngine.cpp', | |||
| 'JackServerGlobals.cpp', | |||
| 'JackServerLaunch.cpp', | |||
| 'timestamps.c', | |||
| 'JackTools.cpp', | |||
| 'ringbuffer.c', | |||
| @@ -125,7 +123,6 @@ srcfiles_common_clientlib = [ | |||
| 'JackServerLaunch.cpp', | |||
| 'JackError.cpp', | |||
| 'JackFrameTimer.cpp', | |||
| 'JackGlobalsClient.cpp', | |||
| 'JackGraphManager.cpp', | |||
| 'JackLibClient.cpp', | |||
| 'JackLibAPI.cpp', | |||
| @@ -46,7 +46,6 @@ def build(bld): | |||
| 'JackEngine.cpp', | |||
| 'JackExternalClient.cpp', | |||
| 'JackFreewheelDriver.cpp', | |||
| 'JackGlobalsServer.cpp', | |||
| 'JackInternalClient.cpp', | |||
| 'JackLoopbackDriver.cpp', | |||
| 'JackServer.cpp', | |||
| @@ -71,7 +70,6 @@ def build(bld): | |||
| clientlib.target = 'jack' | |||
| clientlib.source = [] + common_libsources | |||
| clientlib.source += [ | |||
| 'JackGlobalsClient.cpp', | |||
| 'JackLibClient.cpp', | |||
| 'JackLibAPI.cpp', | |||
| 'JackSocketClientChannel.cpp', | |||
| @@ -2608,7 +2608,7 @@ extern "C" | |||
| return desc; | |||
| } | |||
| Jack::JackDriverClientInterface* driver_initialize(Jack::JackEngineInterface* engine, Jack::JackSynchro** table, const JSList* params) { | |||
| Jack::JackDriverClientInterface* driver_initialize(Jack::JackEngineInterface* engine, Jack::JackSynchro* table, const JSList* params) { | |||
| jack_nframes_t srate = 48000; | |||
| jack_nframes_t frames_per_interrupt = 1024; | |||
| unsigned long user_nperiods = 2; | |||
| @@ -116,7 +116,7 @@ class JackAlsaDriver : public JackAudioDriver | |||
| public: | |||
| JackAlsaDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro** table): JackAudioDriver(name, alias, engine, table) | |||
| JackAlsaDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro* table): JackAudioDriver(name, alias, engine, table) | |||
| {} | |||
| virtual ~JackAlsaDriver() | |||
| {} | |||
| @@ -913,7 +913,7 @@ extern "C" | |||
| return desc; | |||
| } | |||
| Jack::JackDriverClientInterface* driver_initialize(Jack::JackEngineInterface* engine, Jack::JackSynchro** table, const JSList* params) { | |||
| Jack::JackDriverClientInterface* driver_initialize(Jack::JackEngineInterface* engine, Jack::JackSynchro* table, const JSList* params) { | |||
| const JSList * node; | |||
| const jack_driver_param_t * param; | |||
| @@ -62,7 +62,7 @@ class JackFFADODriver : public JackAudioDriver | |||
| public: | |||
| JackFFADODriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro** table) | |||
| JackFFADODriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro* table) | |||
| : JackAudioDriver(name, alias,engine, table) | |||
| {} | |||
| virtual ~JackFFADODriver() | |||
| @@ -1045,7 +1045,7 @@ extern "C" | |||
| return desc; | |||
| } | |||
| Jack::JackDriverClientInterface* driver_initialize(Jack::JackEngineInterface* engine, Jack::JackSynchro** table, const JSList* params) { | |||
| Jack::JackDriverClientInterface* driver_initialize(Jack::JackEngineInterface* engine, Jack::JackSynchro* table, const JSList* params) { | |||
| unsigned int port = 0; | |||
| unsigned int node_id = -1; | |||
| int nbitems; | |||
| @@ -69,7 +69,7 @@ class JackFreebobDriver : public JackAudioDriver | |||
| public: | |||
| JackFreebobDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro** table) | |||
| JackFreebobDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro* table) | |||
| :JackAudioDriver(name, alias, engine, table) | |||
| {} | |||
| virtual ~JackFreebobDriver() | |||
| @@ -28,6 +28,7 @@ def create_jack_driver_obj(bld, target, sources, uselib = None): | |||
| def build(bld): | |||
| jackd = bld.create_obj('cpp', 'program') | |||
| jackd.includes = ['../common/jack', '../common'] | |||
| jackd.defines = 'HAVE_CONFIG_H' | |||
| jackd.source = ['../common/Jackdmp.cpp'] | |||
| jackd.uselib = 'PTHREAD DL RT' | |||
| jackd.uselib_local = 'serverlib' | |||
| @@ -425,7 +425,7 @@ OSStatus JackCoreAudioDriver::GetTotalChannels(AudioDeviceID device, int* channe | |||
| return err; | |||
| } | |||
| JackCoreAudioDriver::JackCoreAudioDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro** table) | |||
| JackCoreAudioDriver::JackCoreAudioDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro* table) | |||
| : JackAudioDriver(name, alias, engine, table), fJackInputData(NULL), fDriverOutputData(NULL), fState(false), fIOUsage(1.f) | |||
| {} | |||
| @@ -1249,7 +1249,7 @@ extern "C" | |||
| return desc; | |||
| } | |||
| Jack::JackDriverClientInterface* driver_initialize(Jack::JackEngineInterface* engine, Jack::JackSynchro** table, const JSList* params) { | |||
| Jack::JackDriverClientInterface* driver_initialize(Jack::JackEngineInterface* engine, Jack::JackSynchro* table, const JSList* params) { | |||
| jack_nframes_t srate = 44100; | |||
| jack_nframes_t frames_per_interrupt = 128; | |||
| int capture = FALSE; | |||
| @@ -143,7 +143,7 @@ class JackCoreAudioDriver : public JackAudioDriver | |||
| public: | |||
| JackCoreAudioDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro** table); | |||
| JackCoreAudioDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro* table); | |||
| virtual ~JackCoreAudioDriver(); | |||
| int Open(jack_nframes_t frames_per_cycle, | |||
| @@ -33,15 +33,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| namespace Jack | |||
| { | |||
| JackMachClientChannel::JackMachClientChannel():fPrivatePort(0) | |||
| { | |||
| fThread = new JackMachThread(this); | |||
| } | |||
| JackMachClientChannel::JackMachClientChannel():fPrivatePort(0),fThread(this) | |||
| {} | |||
| JackMachClientChannel::~JackMachClientChannel() | |||
| { | |||
| delete fThread; | |||
| } | |||
| {} | |||
| // Server <===> client | |||
| @@ -118,7 +114,7 @@ int JackMachClientChannel::Start() | |||
| /* | |||
| To be sure notification thread is started before ClientOpen is called. | |||
| */ | |||
| if (fThread->StartSync() != 0) { | |||
| if (fThread.StartSync() != 0) { | |||
| jack_error("Cannot start Jack client listener"); | |||
| return -1; | |||
| } else { | |||
| @@ -129,7 +125,7 @@ int JackMachClientChannel::Start() | |||
| void JackMachClientChannel::Stop() | |||
| { | |||
| jack_log("JackMachClientChannel::Stop"); | |||
| fThread->Kill(); | |||
| fThread.Kill(); | |||
| } | |||
| void JackMachClientChannel::ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result) | |||
| @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #include "JackChannel.h" | |||
| #include "JackMachPort.h" | |||
| #include "JackThread.h" | |||
| #include "JackPlatformThread.h" | |||
| namespace Jack | |||
| { | |||
| @@ -33,7 +33,7 @@ class JackLibClient; | |||
| \brief JackClientChannel using Mach IPC. | |||
| */ | |||
| class JackMachClientChannel : public JackClientChannelInterface, public JackRunnableInterface | |||
| class JackMachClientChannel : public detail::JackClientChannelInterface, public JackRunnableInterface | |||
| { | |||
| private: | |||
| @@ -41,7 +41,7 @@ class JackMachClientChannel : public JackClientChannelInterface, public JackRunn | |||
| JackMachPort fClientPort; /*! Mach port to communicate with the server : from server to client */ | |||
| JackMachPort fServerPort; /*! Mach port to communicate with the server : from client to server */ | |||
| mach_port_t fPrivatePort; | |||
| JackThread* fThread; /*! Thread to execute the event loop */ | |||
| JackThread fThread; /*! Thread to execute the event loop */ | |||
| public: | |||
| @@ -58,6 +58,8 @@ class JackMachClientChannel : public JackClientChannelInterface, public JackRunn | |||
| void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result); | |||
| void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result) | |||
| {} | |||
| void ClientClose(int refnum, int* result); | |||
| void ClientActivate(int refnum, int state, int* result); | |||
| @@ -30,7 +30,7 @@ namespace Jack | |||
| \brief JackNotifyChannel using Mach IPC. | |||
| */ | |||
| class JackMachNotifyChannel : public JackNotifyChannelInterface | |||
| class JackMachNotifyChannel | |||
| { | |||
| private: | |||
| @@ -41,8 +41,6 @@ class JackMachNotifyChannel : public JackNotifyChannelInterface | |||
| JackMachNotifyChannel() | |||
| {} | |||
| virtual ~JackMachNotifyChannel() | |||
| {} | |||
| int Open(const char* name); // Open the Server/Client connection | |||
| void Close(); // Close the Server/Client connection | |||
| @@ -35,7 +35,7 @@ namespace Jack | |||
| \brief Inter process synchronization using using Mach semaphore. | |||
| */ | |||
| class JackMachSemaphore : public JackSynchro | |||
| class JackMachSemaphore : public detail::JackSynchro | |||
| { | |||
| private: | |||
| @@ -49,9 +49,7 @@ class JackMachSemaphore : public JackSynchro | |||
| public: | |||
| JackMachSemaphore(): JackSynchro(), fSemaphore(0) | |||
| {} | |||
| virtual ~JackMachSemaphore() | |||
| JackMachSemaphore(): fSemaphore(0) | |||
| {} | |||
| bool Signal(); | |||
| @@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #include "JackRPCEngineServer.c" | |||
| #include "JackError.h" | |||
| #include "JackServer.h" | |||
| #include "JackMachThread.h" | |||
| #include "JackEngine.h" | |||
| #include "JackNotification.h" | |||
| @@ -36,15 +35,11 @@ namespace Jack | |||
| map<mach_port_t, JackMachServerChannel*> JackMachServerChannel::fPortTable; | |||
| JackMachServerChannel::JackMachServerChannel() | |||
| { | |||
| fThread = new JackMachThread(this); | |||
| } | |||
| JackMachServerChannel::JackMachServerChannel():fThread(this) | |||
| {} | |||
| JackMachServerChannel::~JackMachServerChannel() | |||
| { | |||
| delete fThread; | |||
| } | |||
| {} | |||
| int JackMachServerChannel::Open(const char* server_name, JackServer* server) | |||
| { | |||
| @@ -57,7 +52,7 @@ int JackMachServerChannel::Open(const char* server_name, JackServer* server) | |||
| return -1; | |||
| } | |||
| if (fThread->Start() != 0) { | |||
| if (fThread.Start() != 0) { | |||
| jack_error("Cannot start Jack server listener"); | |||
| return -1; | |||
| } | |||
| @@ -70,7 +65,7 @@ int JackMachServerChannel::Open(const char* server_name, JackServer* server) | |||
| void JackMachServerChannel::Close() | |||
| { | |||
| jack_log("JackMachServerChannel::Close"); | |||
| fThread->Kill(); | |||
| fThread.Kill(); | |||
| fServerPort.DestroyPort(); | |||
| } | |||
| @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
| #define __JackMachServerChannel__ | |||
| #include "JackChannel.h" | |||
| #include "JackThread.h" | |||
| #include "JackPlatformThread.h" | |||
| #include "JackMachPort.h" | |||
| #include <map> | |||
| @@ -35,13 +35,13 @@ class JackEngineInterface; | |||
| \brief JackServerChannel using Mach IPC. | |||
| */ | |||
| class JackMachServerChannel : public JackServerChannelInterface, public JackRunnableInterface | |||
| class JackMachServerChannel : public JackRunnableInterface | |||
| { | |||
| private: | |||
| JackMachPortSet fServerPort; /*! Mach port to communicate with the server : from client to server */ | |||
| JackThread* fThread; /*! Thread to execute the event loop */ | |||
| JackThread fThread; /*! Thread to execute the event loop */ | |||
| JackServer* fServer; | |||
| std::map<mach_port_t, int> fClientTable; | |||
| @@ -50,7 +50,7 @@ class JackMachServerChannel : public JackServerChannelInterface, public JackRunn | |||
| public: | |||
| JackMachServerChannel(); | |||
| virtual ~JackMachServerChannel(); | |||
| ~JackMachServerChannel(); | |||
| int Open(const char* server_name, JackServer* server); // Open the Server/Client connection | |||
| void Close(); // Close the Server/Client connection | |||
| @@ -30,7 +30,7 @@ namespace Jack | |||
| \brief JackServerNotifyChannel using Mach IPC. | |||
| */ | |||
| class JackMachServerNotifyChannel : public JackServerNotifyChannelInterface | |||
| class JackMachServerNotifyChannel | |||
| { | |||
| private: | |||
| @@ -41,8 +41,6 @@ class JackMachServerNotifyChannel : public JackServerNotifyChannelInterface | |||
| JackMachServerNotifyChannel() | |||
| {} | |||
| virtual ~JackMachServerNotifyChannel() | |||
| {} | |||
| int Open(const char* server_name); // Open the Server/Client connection | |||
| void Close(); // Close the Server/Client connection | |||
| @@ -164,6 +164,11 @@ int JackMachThread::AcquireRealTime() | |||
| return (fThread) ? AcquireRealTimeImp(fThread, fPeriod, fComputation, fConstraint) : -1; | |||
| } | |||
| int JackMachThread::AcquireRealTime(int priority) | |||
| { | |||
| fPriority = priority; | |||
| return AcquireRealTime(); | |||
| } | |||
| int JackMachThread::AcquireRealTimeImp(pthread_t thread, UInt64 period, UInt64 computation, UInt64 constraint) | |||
| { | |||
| @@ -97,19 +97,14 @@ class JackMachThread : public JackPosixThread | |||
| : JackPosixThread(runnable), fPeriod(period), fComputation(computation), fConstraint(constraint) | |||
| {} | |||
| JackMachThread(JackRunnableInterface* runnable) | |||
| : JackPosixThread(runnable), fPeriod(0), fComputation(0), fConstraint(0) | |||
| {} | |||
| JackMachThread(JackRunnableInterface* runnable, int cancellation) | |||
| JackMachThread(JackRunnableInterface* runnable, int cancellation = PTHREAD_CANCEL_ASYNCHRONOUS) | |||
| : JackPosixThread(runnable, cancellation), fPeriod(0), fComputation(0), fConstraint(0) | |||
| {} | |||
| virtual ~JackMachThread() | |||
| {} | |||
| int Kill(); | |||
| int AcquireRealTime(); | |||
| int AcquireRealTime(int priority); | |||
| int DropRealTime(); | |||
| void SetParams(UInt64 period, UInt64 computation, UInt64 constraint); | |||
| static int GetParams(UInt64* period, UInt64* computation, UInt64* constraint); | |||
| @@ -157,7 +157,6 @@ | |||
| 4B35C4690D4731D1000DE7AE /* JackMachThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */; }; | |||
| 4B35C46A0D4731D1000DE7AE /* JackMachClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB29AE08AF45FD00D450D4 /* JackMachClientChannel.cpp */; }; | |||
| 4B35C46D0D4731D1000DE7AE /* JackTime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF773AA08B3414500149912 /* JackTime.c */; }; | |||
| 4B35C46E0D4731D1000DE7AE /* JackGlobalsClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B123D3308B3954300540632 /* JackGlobalsClient.cpp */; }; | |||
| 4B35C4700D4731D1000DE7AE /* JackGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */; }; | |||
| 4B35C4720D4731D1000DE7AE /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B003AB008E2B2BA0060EFDC /* ringbuffer.c */; }; | |||
| 4B35C4730D4731D1000DE7AE /* JackDebugClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B98AE000931D30C0091932A /* JackDebugClient.cpp */; }; | |||
| @@ -245,7 +244,6 @@ | |||
| 4B35C4DE0D4731D1000DE7AE /* JackExternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F80834EFBD00C94B91 /* JackExternalClient.cpp */; }; | |||
| 4B35C4DF0D4731D1000DE7AE /* JackInternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1ED0834EF9200C94B91 /* JackInternalClient.cpp */; }; | |||
| 4B35C4E00D4731D1000DE7AE /* JackRPCClientUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B759076B731100D170DE /* JackRPCClientUser.c */; }; | |||
| 4B35C4E10D4731D1000DE7AE /* JackGlobalsServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B123D3608B3954A00540632 /* JackGlobalsServer.cpp */; }; | |||
| 4B35C4E20D4731D1000DE7AE /* JackServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2210834F05C00C94B91 /* JackServer.cpp */; }; | |||
| 4B35C4E60D4731D1000DE7AE /* JackMacEngineRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */; }; | |||
| 4B35C4E70D4731D1000DE7AE /* JackMachNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB298808AF450200D450D4 /* JackMachNotifyChannel.cpp */; }; | |||
| @@ -368,7 +366,6 @@ | |||
| 4B699C36097D421600A18468 /* JackMachThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */; }; | |||
| 4B699C37097D421600A18468 /* JackMachClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB29AE08AF45FD00D450D4 /* JackMachClientChannel.cpp */; }; | |||
| 4B699C3A097D421600A18468 /* JackTime.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF773AA08B3414500149912 /* JackTime.c */; }; | |||
| 4B699C3B097D421600A18468 /* JackGlobalsClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B123D3308B3954300540632 /* JackGlobalsClient.cpp */; }; | |||
| 4B699C3D097D421600A18468 /* JackGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */; }; | |||
| 4B699C3F097D421600A18468 /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B003AB008E2B2BA0060EFDC /* ringbuffer.c */; }; | |||
| 4B699C40097D421600A18468 /* JackDebugClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B98AE000931D30C0091932A /* JackDebugClient.cpp */; }; | |||
| @@ -432,7 +429,6 @@ | |||
| 4B699C99097D421600A18468 /* JackExternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F80834EFBD00C94B91 /* JackExternalClient.cpp */; }; | |||
| 4B699C9A097D421600A18468 /* JackInternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1ED0834EF9200C94B91 /* JackInternalClient.cpp */; }; | |||
| 4B699C9B097D421600A18468 /* JackRPCClientUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B759076B731100D170DE /* JackRPCClientUser.c */; }; | |||
| 4B699C9C097D421600A18468 /* JackGlobalsServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B123D3608B3954A00540632 /* JackGlobalsServer.cpp */; }; | |||
| 4B699C9D097D421600A18468 /* JackServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2210834F05C00C94B91 /* JackServer.cpp */; }; | |||
| 4B699CA1097D421600A18468 /* JackMacEngineRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */; }; | |||
| 4B699CA2097D421600A18468 /* JackMachNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB298808AF450200D450D4 /* JackMachNotifyChannel.cpp */; }; | |||
| @@ -1001,8 +997,6 @@ | |||
| 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; }; | |||
| 4B123D3308B3954300540632 /* JackGlobalsClient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackGlobalsClient.cpp; path = ../common/JackGlobalsClient.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 4B123D3608B3954A00540632 /* JackGlobalsServer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackGlobalsServer.cpp; path = ../common/JackGlobalsServer.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 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; }; | |||
| @@ -1140,6 +1134,13 @@ | |||
| 4BC3988908B3CF6C00B6F371 /* JackDummyDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackDummyDriver.cpp; path = ../common/JackDummyDriver.cpp; sourceTree = SOURCE_ROOT; }; | |||
| 4BC3988A08B3CF6C00B6F371 /* JackDummyDriver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackDummyDriver.h; path = ../common/JackDummyDriver.h; sourceTree = SOURCE_ROOT; }; | |||
| 4BC8326D0DF42C7D00DD1C93 /* JackMutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackMutex.h; path = ../common/JackMutex.h; sourceTree = SOURCE_ROOT; }; | |||
| 4BC834940DF4632F00DD1C93 /* JackPlatformClientChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackPlatformClientChannel.h; path = ../common/JackPlatformClientChannel.h; sourceTree = SOURCE_ROOT; }; | |||
| 4BC834950DF4632F00DD1C93 /* JackPlatformNotifyChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackPlatformNotifyChannel.h; path = ../common/JackPlatformNotifyChannel.h; sourceTree = SOURCE_ROOT; }; | |||
| 4BC834960DF4632F00DD1C93 /* JackPlatformProcessSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackPlatformProcessSync.h; path = ../common/JackPlatformProcessSync.h; sourceTree = SOURCE_ROOT; }; | |||
| 4BC834970DF4632F00DD1C93 /* JackPlatformServerChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackPlatformServerChannel.h; path = ../common/JackPlatformServerChannel.h; sourceTree = SOURCE_ROOT; }; | |||
| 4BC834980DF4632F00DD1C93 /* JackPlatformServerNotifyChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackPlatformServerNotifyChannel.h; path = ../common/JackPlatformServerNotifyChannel.h; sourceTree = SOURCE_ROOT; }; | |||
| 4BC834990DF4632F00DD1C93 /* JackPlatformSynchro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackPlatformSynchro.h; path = ../common/JackPlatformSynchro.h; sourceTree = SOURCE_ROOT; }; | |||
| 4BC8349A0DF4632F00DD1C93 /* JackPlatformThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackPlatformThread.h; path = ../common/JackPlatformThread.h; sourceTree = SOURCE_ROOT; }; | |||
| 4BCC87950D57168300A7FEB1 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = /System/Library/Frameworks/Accelerate.framework; sourceTree = "<absolute>"; }; | |||
| 4BD4B4D409BACD9600750C0F /* JackTransportEngine.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackTransportEngine.h; path = ../common/JackTransportEngine.h; sourceTree = SOURCE_ROOT; }; | |||
| 4BD4B4D509BACD9600750C0F /* JackTransportEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackTransportEngine.cpp; path = ../common/JackTransportEngine.cpp; sourceTree = SOURCE_ROOT; }; | |||
| @@ -1926,8 +1927,6 @@ | |||
| 4B66A8580934964500A89560 /* JackConstants.h */, | |||
| 4BFB73F608AD291A00DB99B8 /* JackGlobals.h */, | |||
| 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */, | |||
| 4B123D3308B3954300540632 /* JackGlobalsClient.cpp */, | |||
| 4B123D3608B3954A00540632 /* JackGlobalsServer.cpp */, | |||
| 4BF8D2190834F03D00C94B91 /* JackEngineControl.h */, | |||
| 4B6F7AEC0CD0CDBD00F48A9D /* JackEngineControl.cpp */, | |||
| 4BD4B4D409BACD9600750C0F /* JackTransportEngine.h */, | |||
| @@ -1945,6 +1944,7 @@ | |||
| isa = PBXGroup; | |||
| children = ( | |||
| 4BF8D19F0834EE9E00C94B91 /* JackThread.h */, | |||
| 4BC8349A0DF4632F00DD1C93 /* JackPlatformThread.h */, | |||
| 4BF8D1970834EE9700C94B91 /* JackPosixThread.h */, | |||
| 4BF8D1980834EE9700C94B91 /* JackPosixThread.cpp */, | |||
| 4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */, | |||
| @@ -1969,17 +1969,19 @@ | |||
| 4BA3874007947A46008D8992 /* Synchro */ = { | |||
| isa = PBXGroup; | |||
| children = ( | |||
| 4BC8326D0DF42C7D00DD1C93 /* JackMutex.h */, | |||
| 4BD561C708EEB910006BBC2A /* JackSynchro.h */, | |||
| 4BC834960DF4632F00DD1C93 /* JackPlatformProcessSync.h */, | |||
| 4BC834990DF4632F00DD1C93 /* JackPlatformSynchro.h */, | |||
| 4B02069D0DC0BAB400319AF1 /* JackProcessSync.cpp */, | |||
| 4BF8D1A70834EEB400C94B91 /* JackActivationCount.h */, | |||
| 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */, | |||
| 4BD561C708EEB910006BBC2A /* JackSynchro.h */, | |||
| 4B56881008B5C8620022B32D /* JackFifo.h */, | |||
| 4B56880F08B5C8620022B32D /* JackFifo.cpp */, | |||
| 4BF6C1D608ACE64C001E2013 /* JackMachSemaphore.h */, | |||
| 4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */, | |||
| 4BEE0B2D08ACBB9F00D22B43 /* JackPosixSemaphore.h */, | |||
| 4BEE0B2C08ACBB9F00D22B43 /* JackPosixSemaphore.cpp */, | |||
| 4BC8326D0DF42C7D00DD1C93 /* JackMutex.h */, | |||
| ); | |||
| name = Synchro; | |||
| sourceTree = "<group>"; | |||
| @@ -2055,9 +2057,13 @@ | |||
| 4BA550FF05E2423600569492 /* Channels */ = { | |||
| isa = PBXGroup; | |||
| children = ( | |||
| 4BB371D40C1AD85A0050C1E4 /* JackNotification.h */, | |||
| 4BF8D1AF0834EEC400C94B91 /* JackChannel.h */, | |||
| 4BB371D40C1AD85A0050C1E4 /* JackNotification.h */, | |||
| 4BC834970DF4632F00DD1C93 /* JackPlatformServerChannel.h */, | |||
| 4BC834980DF4632F00DD1C93 /* JackPlatformServerNotifyChannel.h */, | |||
| 4BF8D1B30834EED500C94B91 /* JackInternalClientChannel.h */, | |||
| 4BC834940DF4632F00DD1C93 /* JackPlatformClientChannel.h */, | |||
| 4BC834950DF4632F00DD1C93 /* JackPlatformNotifyChannel.h */, | |||
| 4BFB299908AF452300D450D4 /* Socket */, | |||
| 4BFB299808AF451200D450D4 /* Mach */, | |||
| ); | |||
| @@ -4548,7 +4554,6 @@ | |||
| 4B35C4690D4731D1000DE7AE /* JackMachThread.cpp in Sources */, | |||
| 4B35C46A0D4731D1000DE7AE /* JackMachClientChannel.cpp in Sources */, | |||
| 4B35C46D0D4731D1000DE7AE /* JackTime.c in Sources */, | |||
| 4B35C46E0D4731D1000DE7AE /* JackGlobalsClient.cpp in Sources */, | |||
| 4B35C4700D4731D1000DE7AE /* JackGlobals.cpp in Sources */, | |||
| 4B35C4720D4731D1000DE7AE /* ringbuffer.c in Sources */, | |||
| 4B35C4730D4731D1000DE7AE /* JackDebugClient.cpp in Sources */, | |||
| @@ -4596,7 +4601,6 @@ | |||
| 4B35C4DE0D4731D1000DE7AE /* JackExternalClient.cpp in Sources */, | |||
| 4B35C4DF0D4731D1000DE7AE /* JackInternalClient.cpp in Sources */, | |||
| 4B35C4E00D4731D1000DE7AE /* JackRPCClientUser.c in Sources */, | |||
| 4B35C4E10D4731D1000DE7AE /* JackGlobalsServer.cpp in Sources */, | |||
| 4B35C4E20D4731D1000DE7AE /* JackServer.cpp in Sources */, | |||
| 4B35C4E60D4731D1000DE7AE /* JackMacEngineRPC.cpp in Sources */, | |||
| 4B35C4E70D4731D1000DE7AE /* JackMachNotifyChannel.cpp in Sources */, | |||
| @@ -4918,7 +4922,6 @@ | |||
| 4B699C36097D421600A18468 /* JackMachThread.cpp in Sources */, | |||
| 4B699C37097D421600A18468 /* JackMachClientChannel.cpp in Sources */, | |||
| 4B699C3A097D421600A18468 /* JackTime.c in Sources */, | |||
| 4B699C3B097D421600A18468 /* JackGlobalsClient.cpp in Sources */, | |||
| 4B699C3D097D421600A18468 /* JackGlobals.cpp in Sources */, | |||
| 4B699C3F097D421600A18468 /* ringbuffer.c in Sources */, | |||
| 4B699C40097D421600A18468 /* JackDebugClient.cpp in Sources */, | |||
| @@ -4966,7 +4969,6 @@ | |||
| 4B699C99097D421600A18468 /* JackExternalClient.cpp in Sources */, | |||
| 4B699C9A097D421600A18468 /* JackInternalClient.cpp in Sources */, | |||
| 4B699C9B097D421600A18468 /* JackRPCClientUser.c in Sources */, | |||
| 4B699C9C097D421600A18468 /* JackGlobalsServer.cpp in Sources */, | |||
| 4B699C9D097D421600A18468 /* JackServer.cpp in Sources */, | |||
| 4B699CA1097D421600A18468 /* JackMacEngineRPC.cpp in Sources */, | |||
| 4B699CA2097D421600A18468 /* JackMachNotifyChannel.cpp in Sources */, | |||
| @@ -11093,7 +11095,9 @@ | |||
| GCC_ENABLE_FIX_AND_CONTINUE = YES; | |||
| GCC_GENERATE_DEBUGGING_SYMBOLS = YES; | |||
| GCC_OPTIMIZATION_LEVEL = 0; | |||
| HEADER_SEARCH_PATHS = ../common; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| CoreAudio, | |||
| @@ -11130,8 +11134,10 @@ | |||
| ); | |||
| FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\""; | |||
| GCC_ENABLE_FIX_AND_CONTINUE = NO; | |||
| HEADER_SEARCH_PATHS = ../common; | |||
| MACOSX_DEPLOYMENT_TARGET = 10.4; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| CoreAudio, | |||
| @@ -11166,7 +11172,9 @@ | |||
| "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", | |||
| ); | |||
| FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\""; | |||
| HEADER_SEARCH_PATHS = ../common; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| AudioToolBox, | |||
| @@ -11207,7 +11215,9 @@ | |||
| GCC_ENABLE_FIX_AND_CONTINUE = YES; | |||
| GCC_GENERATE_DEBUGGING_SYMBOLS = YES; | |||
| GCC_OPTIMIZATION_LEVEL = 0; | |||
| HEADER_SEARCH_PATHS = ../common; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| CoreAudio, | |||
| @@ -11244,8 +11254,10 @@ | |||
| ); | |||
| FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\""; | |||
| GCC_ENABLE_FIX_AND_CONTINUE = NO; | |||
| HEADER_SEARCH_PATHS = ../common; | |||
| MACOSX_DEPLOYMENT_TARGET = 10.4; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| CoreAudio, | |||
| @@ -11280,7 +11292,9 @@ | |||
| "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", | |||
| ); | |||
| FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\""; | |||
| HEADER_SEARCH_PATHS = ../common; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| AudioToolBox, | |||
| @@ -11321,7 +11335,9 @@ | |||
| GCC_ENABLE_FIX_AND_CONTINUE = YES; | |||
| GCC_GENERATE_DEBUGGING_SYMBOLS = YES; | |||
| GCC_OPTIMIZATION_LEVEL = 0; | |||
| HEADER_SEARCH_PATHS = ../common; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| CoreAudio, | |||
| @@ -11358,8 +11374,10 @@ | |||
| ); | |||
| FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\""; | |||
| GCC_ENABLE_FIX_AND_CONTINUE = NO; | |||
| HEADER_SEARCH_PATHS = ../common; | |||
| MACOSX_DEPLOYMENT_TARGET = 10.4; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| CoreAudio, | |||
| @@ -11394,7 +11412,9 @@ | |||
| "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", | |||
| ); | |||
| FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/build/Development\""; | |||
| HEADER_SEARCH_PATHS = ../common; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| AudioToolBox, | |||
| @@ -11441,7 +11461,7 @@ | |||
| MACH_O_TYPE = mh_dylib; | |||
| OPTIMIZATION_CFLAGS = "-O0"; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| Jackservermp, | |||
| @@ -11486,7 +11506,7 @@ | |||
| MACH_O_TYPE = mh_dylib; | |||
| MACOSX_DEPLOYMENT_TARGET = 10.4; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| Jackservermp, | |||
| @@ -11528,7 +11548,7 @@ | |||
| LIBRARY_STYLE = DYNAMIC; | |||
| MACH_O_TYPE = mh_dylib; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| Jackdmp, | |||
| @@ -11576,6 +11596,7 @@ | |||
| MACH_O_TYPE = mh_dylib; | |||
| OPTIMIZATION_CFLAGS = "-O0"; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| Jackservermp, | |||
| @@ -11619,6 +11640,7 @@ | |||
| MACH_O_TYPE = mh_dylib; | |||
| MACOSX_DEPLOYMENT_TARGET = 10.4; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| Jackservermp, | |||
| @@ -11659,6 +11681,7 @@ | |||
| LIBRARY_STYLE = DYNAMIC; | |||
| MACH_O_TYPE = mh_dylib; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| "-framework", | |||
| Jackdmp, | |||
| @@ -11726,7 +11749,7 @@ | |||
| MACH_O_TYPE = mh_dylib; | |||
| OPTIMIZATION_CFLAGS = "-O0"; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| libportaudio.a, | |||
| "-framework", | |||
| @@ -11775,7 +11798,7 @@ | |||
| MACH_O_TYPE = mh_dylib; | |||
| MACOSX_DEPLOYMENT_TARGET = 10.4; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| libportaudio.a, | |||
| "-framework", | |||
| @@ -11821,7 +11844,7 @@ | |||
| LIBRARY_STYLE = DYNAMIC; | |||
| MACH_O_TYPE = mh_dylib; | |||
| OTHER_CFLAGS = ""; | |||
| OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; | |||
| OTHER_CPLUSPLUSFLAGS = "-DMACH_RPC_MACH_SEMA"; | |||
| OTHER_LDFLAGS = ( | |||
| libportaudio.a, | |||
| "-framework", | |||
| @@ -24,13 +24,13 @@ | |||
| #ifdef __APPLE__ | |||
| #include "JackMachSemaphore.h" | |||
| #include "JackMachThread.h" | |||
| #endif | |||
| #include "JackPosixThread.h" | |||
| #include "JackPosixSemaphore.h" | |||
| #include "JackFifo.h" | |||
| #include "JackPlatformThread.h" | |||
| #define ITER 500000 | |||
| using namespace Jack; | |||
| @@ -38,8 +38,8 @@ using namespace Jack; | |||
| struct ServerThread : public JackRunnableInterface { | |||
| JackThread* fThread; | |||
| JackSynchro* fServerSem; | |||
| JackSynchro* fClientSem; | |||
| detail::JackSynchro* fServerSem; | |||
| detail::JackSynchro* fClientSem; | |||
| ServerThread() | |||
| { | |||
| @@ -72,8 +72,8 @@ struct ServerThread : public JackRunnableInterface { | |||
| struct ClientThread : public JackRunnableInterface { | |||
| JackThread* fThread; | |||
| JackSynchro* fServerSem; | |||
| JackSynchro* fClientSem; | |||
| detail::JackSynchro* fServerSem; | |||
| detail::JackSynchro* fClientSem; | |||
| ClientThread() | |||
| { | |||
| @@ -110,7 +110,7 @@ struct ClientThread : public JackRunnableInterface { | |||
| }; | |||
| void server(JackSynchro* sem) | |||
| void server(detail::JackSynchro* sem) | |||
| { | |||
| char c; | |||
| printf("server\n"); | |||
| @@ -137,7 +137,7 @@ void server(JackSynchro* sem) | |||
| } | |||
| } | |||
| void client(JackSynchro* sem) | |||
| void client(detail::JackSynchro* sem) | |||
| { | |||
| char c; | |||
| printf("client\n"); | |||
| @@ -168,7 +168,7 @@ int main (int argc, char * const argv[]) | |||
| char c; | |||
| ServerThread* serverthread = NULL; | |||
| ClientThread* clientthread = NULL; | |||
| JackSynchro* sem1 = NULL; | |||
| detail::JackSynchro* sem1 = NULL; | |||
| if (strcmp(argv[1],"-s") == 0) { | |||
| printf("Posix semaphore\n"); | |||
| @@ -36,20 +36,19 @@ | |||
| #ifdef __APPLE__ | |||
| #include "JackMachSemaphore.h" | |||
| #include "JackMachThread.h" | |||
| #endif | |||
| #ifdef WIN32 | |||
| #include "JackWinThread.h" | |||
| #include "JackWinEvent.h" | |||
| #endif | |||
| #ifdef linux | |||
| #include "JackPosixThread.h" | |||
| #include "JackPosixSemaphore.h" | |||
| #include "JackFifo.h" | |||
| #endif | |||
| #include "JackPlatformThread.h" | |||
| #define ITER 1000 | |||
| #define SERVER "serveur3" | |||
| @@ -62,12 +61,12 @@ class Test2 : public JackRunnableInterface | |||
| private: | |||
| JackSynchro* fSynchro1; | |||
| JackSynchro* fSynchro2; | |||
| detail::JackSynchro* fSynchro1; | |||
| detail::JackSynchro* fSynchro2; | |||
| public: | |||
| Test2(JackSynchro* synchro1, JackSynchro* synchro2) | |||
| Test2(detail::JackSynchro* synchro1, detail::JackSynchro* synchro2) | |||
| : fSynchro1(synchro1), fSynchro2(synchro2) | |||
| {} | |||
| @@ -89,8 +88,8 @@ class Test2 : public JackRunnableInterface | |||
| int main(int ac, char *av []) | |||
| { | |||
| Test2* obj; | |||
| JackSynchro* sem1 = NULL; | |||
| JackSynchro* sem2 = NULL; | |||
| detail::JackSynchro* sem1 = NULL; | |||
| detail::JackSynchro* sem2 = NULL; | |||
| JackThread* thread; | |||
| printf("Test of synchronization primitives : client side\n"); | |||
| @@ -36,20 +36,19 @@ | |||
| #ifdef __APPLE__ | |||
| #include "JackMachSemaphore.h" | |||
| #include "JackMachThread.h" | |||
| #endif | |||
| #ifdef WIN32 | |||
| #include "JackWinThread.h" | |||
| #include "JackWinEvent.h" | |||
| #endif | |||
| #ifdef linux | |||
| #include "JackPosixThread.h" | |||
| #include "JackPosixSemaphore.h" | |||
| #include "JackFifo.h" | |||
| #endif | |||
| #include "JackPlatformThread.h" | |||
| #define ITER 1000 | |||
| #define SERVER "serveur3" | |||
| @@ -91,12 +90,12 @@ class Test1 : public JackRunnableInterface | |||
| private: | |||
| JackSynchro* fSynchro1; | |||
| JackSynchro* fSynchro2; | |||
| detail::JackSynchro* fSynchro1; | |||
| detail::JackSynchro* fSynchro2; | |||
| public: | |||
| Test1(JackSynchro* synchro1, JackSynchro* synchro2) | |||
| Test1(detail::JackSynchro* synchro1, detail::JackSynchro* synchro2) | |||
| : fSynchro1(synchro1), fSynchro2(synchro2) | |||
| {} | |||
| @@ -138,8 +137,8 @@ class Test1 : public JackRunnableInterface | |||
| int main(int ac, char *av []) | |||
| { | |||
| Test1* obj; | |||
| JackSynchro* sem1 = NULL; | |||
| JackSynchro* sem2 = NULL; | |||
| detail::JackSynchro* sem1 = NULL; | |||
| detail::JackSynchro* sem2 = NULL; | |||
| JackThread* thread; | |||
| #ifdef WIN32 | |||
| @@ -6,7 +6,7 @@ | |||
| the Free Software Foundation; either version 2 of the License, or | |||
| (at your option) any later version. | |||
| This program is distributed in the hope that it will be useful, | |||
| This program is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| GNU General Public License for more details. | |||
| @@ -36,25 +36,26 @@ | |||
| #ifdef __APPLE__ | |||
| #include "JackMachSemaphore.h" | |||
| #include "JackMachThread.h" | |||
| #endif | |||
| #ifdef WIN32 | |||
| #include "JackWinThread.h" | |||
| #include "JackWinEvent.h" | |||
| #endif | |||
| #ifdef linux | |||
| #include "JackPosixThread.h" | |||
| #include "JackPosixSemaphore.h" | |||
| #include "JackFifo.h" | |||
| #endif | |||
| #include "JackPlatformThread.h" | |||
| #define ITER 100000 | |||
| #define SERVER "serveur1" | |||
| #define CLIENT "client1" | |||
| #include "JackPlatformSynchro.h" | |||
| using namespace Jack; | |||
| #ifdef WIN32 | |||
| @@ -86,17 +87,18 @@ static BOOL overhead (long * overhead) | |||
| #endif | |||
| template <typename sync_type> | |||
| class Test1 : public JackRunnableInterface | |||
| { | |||
| private: | |||
| JackSynchro* fSynchro1; | |||
| JackSynchro* fSynchro2; | |||
| sync_type* fSynchro1; | |||
| sync_type* fSynchro2; | |||
| public: | |||
| Test1(JackSynchro* synchro1, JackSynchro* synchro2) | |||
| Test1(sync_type* synchro1, sync_type* synchro2) | |||
| : fSynchro1(synchro1), fSynchro2(synchro2) | |||
| {} | |||
| @@ -136,17 +138,18 @@ class Test1 : public JackRunnableInterface | |||
| }; | |||
| template <typename sync_type> | |||
| class Test2 : public JackRunnableInterface | |||
| { | |||
| private: | |||
| JackSynchro* fSynchro1; | |||
| JackSynchro* fSynchro2; | |||
| sync_type* fSynchro1; | |||
| sync_type* fSynchro2; | |||
| public: | |||
| Test2(JackSynchro* synchro1, JackSynchro* synchro2) | |||
| Test2(sync_type* synchro1, sync_type* synchro2) | |||
| : fSynchro1(synchro1), fSynchro2(synchro2) | |||
| {} | |||
| @@ -162,17 +165,59 @@ class Test2 : public JackRunnableInterface | |||
| }; | |||
| int main(int ac, char *av []) | |||
| template <typename sync_type> | |||
| void run_tests(void) | |||
| { | |||
| Test1* obj1; | |||
| Test2* obj2; | |||
| JackSynchro* sem1 = NULL; | |||
| JackSynchro* sem2 = NULL; | |||
| JackSynchro* sem3 = NULL; | |||
| JackSynchro* sem4 = NULL; | |||
| sync_type sem1, sem2, sem3, sem4; | |||
| sem1.Allocate(SERVER, "default", 0); | |||
| sem2.Allocate(CLIENT, "default", 0); | |||
| sem3.ConnectOutput(SERVER, "default"); | |||
| sem4.ConnectInput(CLIENT, "default"); | |||
| Test1<sync_type> obj1(&sem1, &sem2); | |||
| Test2<sync_type> obj2(&sem3, &sem4); | |||
| JackThread* thread1; | |||
| JackThread* thread2; | |||
| #ifdef __APPLE__ | |||
| thread1 = new JackMachThread(&obj1, 10000 * 1000, 500 * 1000, 10000 * 1000); | |||
| thread2 = new JackMachThread(&obj2, 10000 * 1000, 500 * 1000, 10000 * 1000); | |||
| #endif | |||
| #ifdef WIN32 | |||
| thread1 = new JackWinThread(&obj1); | |||
| thread2 = new JackWinThread(&obj2); | |||
| #endif | |||
| #ifdef linux | |||
| thread1 = new JackPosixThread(&obj1, false, 50, PTHREAD_CANCEL_DEFERRED); | |||
| thread2 = new JackPosixThread(&obj2, false, 50, PTHREAD_CANCEL_DEFERRED); | |||
| #endif | |||
| thread1->Start(); | |||
| thread2->Start(); | |||
| //thread1->AcquireRealTime(); | |||
| //thread2->AcquireRealTime(); | |||
| #ifdef WIN32 | |||
| Sleep(30 * 1000); | |||
| #else | |||
| sleep (30); | |||
| #endif | |||
| thread1->Stop(); | |||
| thread2->Stop(); | |||
| sem3.Disconnect(); | |||
| sem4.Disconnect(); | |||
| sem1.Destroy(); | |||
| sem2.Destroy(); | |||
| delete thread1; | |||
| delete thread2; | |||
| } | |||
| int main(int ac, char *av []) | |||
| { | |||
| #ifdef WIN32 | |||
| if (!QueryPerformanceFrequency (&gFreq) || | |||
| !overhead (&gQueryOverhead)) { | |||
| @@ -189,93 +234,28 @@ int main(int ac, char *av []) | |||
| #ifdef __APPLE__ | |||
| if (strcmp(av[1], "-m") == 0) { | |||
| printf("Mach semaphore\n"); | |||
| sem1 = new JackMachSemaphore(); | |||
| sem2 = new JackMachSemaphore(); | |||
| sem3 = new JackMachSemaphore(); | |||
| sem4 = new JackMachSemaphore(); | |||
| run_tests<JackMachSemaphore>(); | |||
| } | |||
| #endif | |||
| #ifdef WIN32 | |||
| if (strcmp(av[1], "-e") == 0) { | |||
| printf("Win event\n"); | |||
| sem1 = new JackWinEvent(); | |||
| sem2 = new JackWinEvent(); | |||
| sem3 = new JackWinEvent(); | |||
| sem4 = new JackWinEvent(); | |||
| run_tests<JackWinEvent>(); | |||
| } | |||
| #endif | |||
| #ifdef linux | |||
| if (strcmp(av[1], "-s") == 0) { | |||
| printf("Posix semaphore\n"); | |||
| sem1 = new JackPosixSemaphore(); | |||
| sem2 = new JackPosixSemaphore(); | |||
| sem3 = new JackPosixSemaphore(); | |||
| sem4 = new JackPosixSemaphore(); | |||
| run_tests<JackPosixSemaphore>(); | |||
| } | |||
| if (strcmp(av[1], "-f") == 0) { | |||
| printf("Fifo\n"); | |||
| sem1 = new JackFifo(); | |||
| sem2 = new JackFifo(); | |||
| sem3 = new JackFifo(); | |||
| sem4 = new JackFifo(); | |||
| run_tests<JackFifo>(); | |||
| } | |||
| #endif | |||
| if (!sem1->Allocate(SERVER, "default", 0)) | |||
| return -1; | |||
| if (!sem2->Allocate(CLIENT, "default", 0)) | |||
| return -1; | |||
| if (sem3->ConnectOutput(SERVER, "default")) | |||
| return -1; | |||
| if (sem4->ConnectInput(CLIENT, "default")) | |||
| return -1; | |||
| // run test in RT thread | |||
| obj1 = new Test1(sem1, sem2); | |||
| obj2 = new Test2(sem3, sem4); | |||
| #ifdef __APPLE__ | |||
| thread1 = new JackMachThread(obj1, 10000 * 1000, 500 * 1000, 10000 * 1000); | |||
| thread2 = new JackMachThread(obj2, 10000 * 1000, 500 * 1000, 10000 * 1000); | |||
| #endif | |||
| #ifdef WIN32 | |||
| thread1 = new JackWinThread(obj1); | |||
| thread2 = new JackWinThread(obj2); | |||
| #endif | |||
| #ifdef linux | |||
| thread1 = new JackPosixThread(obj1, false, 50, PTHREAD_CANCEL_DEFERRED); | |||
| thread2 = new JackPosixThread(obj2, false, 50, PTHREAD_CANCEL_DEFERRED); | |||
| #endif | |||
| thread1->Start(); | |||
| thread2->Start(); | |||
| //thread1->AcquireRealTime(); | |||
| //thread2->AcquireRealTime(); | |||
| #ifdef WIN32 | |||
| Sleep(30 * 1000); | |||
| #else | |||
| sleep (30); | |||
| #endif | |||
| thread1->Stop(); | |||
| thread2->Stop(); | |||
| sem3->Disconnect(); | |||
| sem4->Disconnect(); | |||
| sem1->Destroy(); | |||
| sem2->Destroy(); | |||
| delete obj1; | |||
| delete obj2; | |||
| delete thread1; | |||
| delete thread2; | |||
| delete sem1; | |||
| delete sem2; | |||
| delete sem3; | |||
| delete sem4; | |||
| return 0; | |||
| } | |||
| @@ -574,7 +574,7 @@ extern "C" | |||
| return desc; | |||
| } | |||
| EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackEngineInterface* engine, Jack::JackSynchro** table, const JSList* params) { | |||
| EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackEngineInterface* engine, Jack::JackSynchro* table, const JSList* params) { | |||
| jack_nframes_t srate = 44100; | |||
| jack_nframes_t frames_per_interrupt = 512; | |||
| int capture = FALSE; | |||
| @@ -53,7 +53,7 @@ class JackPortAudioDriver : public JackAudioDriver | |||
| public: | |||
| JackPortAudioDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro** table) | |||
| JackPortAudioDriver(const char* name, const char* alias, JackEngineInterface* engine, JackSynchro* table) | |||
| : JackAudioDriver(name, alias, engine, table), fStream(NULL), fInputBuffer(NULL), fOutputBuffer(NULL), | |||
| fInputDevice(paNoDevice), fOutputDevice(paNoDevice) | |||
| {} | |||
| @@ -29,16 +29,13 @@ Copyright (C) 2004-2006 Grame | |||
| namespace Jack | |||
| { | |||
| JackWinNamedPipeClientChannel::JackWinNamedPipeClientChannel() | |||
| JackWinNamedPipeClientChannel::JackWinNamedPipeClientChannel():fThread(this) | |||
| { | |||
| fThread = JackGlobals::MakeThread(this); | |||
| fClient = NULL; | |||
| } | |||
| JackWinNamedPipeClientChannel::~JackWinNamedPipeClientChannel() | |||
| { | |||
| delete fThread; | |||
| } | |||
| {} | |||
| int JackWinNamedPipeClientChannel::ServerCheck(const char* server_name) | |||
| { | |||
| @@ -98,7 +95,7 @@ void JackWinNamedPipeClientChannel::Close() | |||
| fRequestPipe.Close(); | |||
| fNotificationListenPipe.Close(); | |||
| // Here the thread will correctly stop when the pipe are closed | |||
| fThread->Stop(); | |||
| fThread.Stop(); | |||
| } | |||
| int JackWinNamedPipeClientChannel::Start() | |||
| @@ -107,7 +104,7 @@ int JackWinNamedPipeClientChannel::Start() | |||
| /* | |||
| To be sure notification thread is started before ClientOpen is called. | |||
| */ | |||
| if (fThread->StartSync() != 0) { | |||
| if (fThread.StartSync() != 0) { | |||
| jack_error("Cannot start Jack client listener"); | |||
| return -1; | |||
| } else { | |||
| @@ -118,7 +115,7 @@ int JackWinNamedPipeClientChannel::Start() | |||
| void JackWinNamedPipeClientChannel::Stop() | |||
| { | |||
| jack_log("JackWinNamedPipeClientChannel::Stop"); | |||
| fThread->Kill(); // Unsafe on WIN32... TODO : solve WIN32 thread Kill issue | |||
| fThread.Kill(); // Unsafe on WIN32... TODO : solve WIN32 thread Kill issue | |||
| } | |||
| void JackWinNamedPipeClientChannel::ServerSyncCall(JackRequest* req, JackResult* res, int* result) | |||
| @@ -22,7 +22,7 @@ Copyright (C) 2004-2006 Grame | |||
| #include "JackChannel.h" | |||
| #include "JackWinNamedPipe.h" | |||
| #include "JackThread.h" | |||
| #include "JackPlatformThread.h" | |||
| #include "JackRequest.h" | |||
| namespace Jack | |||
| @@ -32,14 +32,14 @@ namespace Jack | |||
| \brief JackClientChannel using pipes. | |||
| */ | |||
| class JackWinNamedPipeClientChannel : public JackClientChannelInterface, public JackRunnableInterface | |||
| class JackWinNamedPipeClientChannel : public detail::JackClientChannelInterface, public JackRunnableInterface | |||
| { | |||
| private: | |||
| JackWinNamedPipeClient fRequestPipe; // Pipe to communicate with the server | |||
| JackWinNamedPipeServer fNotificationListenPipe; // Pipe listener for server notification | |||
| JackThread* fThread; // Thread to execute the event loop | |||
| JackThread fThread; // Thread to execute the event loop | |||
| JackClient* fClient; | |||
| void ServerSyncCall(JackRequest* req, JackResult* res, int* result); | |||
| @@ -60,6 +60,8 @@ class JackWinNamedPipeClientChannel : public JackClientChannelInterface, public | |||
| void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result); | |||
| void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result) | |||
| {} | |||
| void ClientClose(int refnum, int* result); | |||
| void ClientActivate(int refnum, int state, int* result); | |||
| @@ -30,7 +30,7 @@ namespace Jack | |||
| \brief JackNotifyChannel using named pipe. | |||
| */ | |||
| class JackWinNamedPipeNotifyChannel : public JackNotifyChannelInterface | |||
| class JackWinNamedPipeNotifyChannel | |||
| { | |||
| private: | |||
| @@ -41,8 +41,6 @@ class JackWinNamedPipeNotifyChannel : public JackNotifyChannelInterface | |||
| JackWinNamedPipeNotifyChannel() | |||
| {} | |||
| virtual ~JackWinNamedPipeNotifyChannel() | |||
| {} | |||
| int Open(const char* name); // Open the Server/Client connection | |||
| void Close(); // Close the Server/Client connection | |||
| @@ -44,9 +44,8 @@ HANDLE JackClientPipeThread::fMutex = NULL; // never released.... | |||
| // fRefNum = -1 correspond to already removed client | |||
| JackClientPipeThread::JackClientPipeThread(JackWinNamedPipeClient* pipe) | |||
| : fPipe(pipe), fServer(NULL), fRefNum(0) | |||
| : fPipe(pipe), fServer(NULL), fRefNum(0), fThread(this) | |||
| { | |||
| fThread = JackGlobals::MakeThread(this); | |||
| if (fMutex == NULL) | |||
| fMutex = CreateMutex(NULL, FALSE, NULL); | |||
| } | |||
| @@ -55,7 +54,6 @@ JackClientPipeThread::~JackClientPipeThread() | |||
| { | |||
| jack_log("JackClientPipeThread::~JackClientPipeThread"); | |||
| delete fPipe; | |||
| delete fThread; | |||
| } | |||
| int JackClientPipeThread::Open(JackServer* server) // Open the Server/Client connection | |||
| @@ -63,7 +61,7 @@ int JackClientPipeThread::Open(JackServer* server) // Open the Server/Client con | |||
| fServer = server; | |||
| // Start listening | |||
| if (fThread->Start() != 0) { | |||
| if (fThread.Start() != 0) { | |||
| jack_error("Cannot start Jack server listener\n"); | |||
| return -1; | |||
| } else { | |||
| @@ -80,7 +78,7 @@ void JackClientPipeThread::Close() // Close the Server/Client connection | |||
| all ressources will be desallocated at the end. | |||
| */ | |||
| fThread->Kill(); | |||
| fThread.Kill(); | |||
| fPipe->Close(); | |||
| fRefNum = -1; | |||
| } | |||
| @@ -354,10 +352,8 @@ void JackClientPipeThread::ClientKill() | |||
| Close(); | |||
| } | |||
| JackWinNamedPipeServerChannel::JackWinNamedPipeServerChannel() | |||
| { | |||
| fThread = JackGlobals::MakeThread(this); | |||
| } | |||
| JackWinNamedPipeServerChannel::JackWinNamedPipeServerChannel():fThread(this) | |||
| {} | |||
| JackWinNamedPipeServerChannel::~JackWinNamedPipeServerChannel() | |||
| { | |||
| @@ -368,8 +364,6 @@ JackWinNamedPipeServerChannel::~JackWinNamedPipeServerChannel() | |||
| client->Close(); | |||
| delete client; | |||
| } | |||
| delete fThread; | |||
| } | |||
| int JackWinNamedPipeServerChannel::Open(const char* server_name, JackServer* server) | |||
| @@ -386,7 +380,7 @@ int JackWinNamedPipeServerChannel::Open(const char* server_name, JackServer* ser | |||
| } | |||
| // Start listening | |||
| if (fThread->Start() != 0) { | |||
| if (fThread.Start() != 0) { | |||
| jack_error("Cannot start Jack server listener\n"); | |||
| goto error; | |||
| } | |||
| @@ -405,10 +399,10 @@ void JackWinNamedPipeServerChannel::Close() | |||
| all ressources will be desallocated at the end. | |||
| fRequestListenPipe.Close(); | |||
| fThread->Stop(); | |||
| fThread.Stop(); | |||
| */ | |||
| fThread->Kill(); | |||
| fThread.Kill(); | |||
| fRequestListenPipe.Close(); | |||
| } | |||
| @@ -22,7 +22,7 @@ Copyright (C) 2004-2006 Grame | |||
| #include "JackChannel.h" | |||
| #include "JackWinNamedPipe.h" | |||
| #include "JackThread.h" | |||
| #include "JackPlatformThread.h" | |||
| #include <map> | |||
| #include <list> | |||
| @@ -36,7 +36,7 @@ class JackClientPipeThread : public JackRunnableInterface | |||
| JackWinNamedPipeClient* fPipe; | |||
| JackServer* fServer; | |||
| JackThread* fThread; | |||
| JackThread fThread; | |||
| int fRefNum; | |||
| void ClientAdd(char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
| @@ -69,14 +69,14 @@ class JackClientPipeThread : public JackRunnableInterface | |||
| \brief JackServerChannel using pipe. | |||
| */ | |||
| class JackWinNamedPipeServerChannel : public JackServerChannelInterface, public JackRunnableInterface | |||
| class JackWinNamedPipeServerChannel : public JackRunnableInterface | |||
| { | |||
| private: | |||
| JackWinNamedPipeServer fRequestListenPipe; // Pipe to create request socket for the client | |||
| JackServer* fServer; | |||
| JackThread* fThread; // Thread to execute the event loop | |||
| JackThread fThread; // Thread to execute the event loop | |||
| char fServerName[64]; | |||
| std::list<JackClientPipeThread*> fClientList; | |||
| @@ -86,7 +86,7 @@ class JackWinNamedPipeServerChannel : public JackServerChannelInterface, public | |||
| public: | |||
| JackWinNamedPipeServerChannel(); | |||
| virtual ~JackWinNamedPipeServerChannel(); | |||
| ~JackWinNamedPipeServerChannel(); | |||
| int Open(const char* server_name, JackServer* server); // Open the Server/Client connection | |||
| void Close(); // Close the Server/Client connection | |||
| @@ -30,7 +30,7 @@ namespace Jack | |||
| \brief JackServerNotifyChannel using pipes. | |||
| */ | |||
| class JackWinNamedPipeServerNotifyChannel : public JackServerNotifyChannelInterface | |||
| class JackWinNamedPipeServerNotifyChannel | |||
| { | |||
| private: | |||
| @@ -40,8 +40,6 @@ class JackWinNamedPipeServerNotifyChannel : public JackServerNotifyChannelInterf | |||
| JackWinNamedPipeServerNotifyChannel() | |||
| {} | |||
| virtual ~JackWinNamedPipeServerNotifyChannel() | |||
| {} | |||
| int Open(const char* server_name); | |||
| void Close(); | |||
| @@ -20,7 +20,6 @@ This program is free software; you can redistribute it and/or modify | |||
| #ifndef __JackWinProcessSync__ | |||
| #define __JackWinProcessSync__ | |||
| #include "JackSyncInterface.h" | |||
| #include <windows.h> | |||
| #include <new> | |||
| @@ -31,7 +30,7 @@ namespace Jack | |||
| \brief A synchronization primitive built using a condition variable. | |||
| */ | |||
| class JackWinProcessSync : public JackSyncInterface | |||
| class JackWinProcessSync | |||
| { | |||
| private: | |||
| @@ -44,7 +43,7 @@ class JackWinProcessSync : public JackSyncInterface | |||
| { | |||
| fEvent = CreateEvent(NULL, FALSE, FALSE, NULL); | |||
| } | |||
| virtual ~JackWinProcessSync() | |||
| ~JackWinProcessSync() | |||
| { | |||
| CloseHandle(fEvent); | |||
| } | |||
| @@ -32,7 +32,7 @@ namespace Jack | |||
| \brief Inter process synchronization using system wide semaphore. | |||
| */ | |||
| class JackWinSemaphore : public JackSynchro | |||
| class JackWinSemaphore : public detail::JackSynchro | |||
| { | |||
| private: | |||
| @@ -45,9 +45,7 @@ class JackWinSemaphore : public JackSynchro | |||
| public: | |||
| JackWinSemaphore(): JackSynchro(), fSemaphore(NULL) | |||
| {} | |||
| virtual ~JackWinSemaphore() | |||
| JackWinSemaphore(): fSemaphore(NULL) | |||
| {} | |||
| bool Signal(); | |||
| @@ -47,7 +47,7 @@ class JackWinThread : public JackThread | |||
| public: | |||
| JackWinThread(JackRunnableInterface* runnable); | |||
| virtual ~JackWinThread(); | |||
| ~JackWinThread(); | |||
| int Start(); | |||
| int StartSync(); | |||