Browse Source

Improve server shutdown and stop.

tags/v1.9.10
Stephane Letz 12 years ago
parent
commit
e32b0cd318
12 changed files with 23 additions and 26 deletions
  1. +6
    -7
      common/JackClient.cpp
  2. +1
    -1
      common/JackClient.h
  3. +2
    -0
      common/JackConstants.h
  4. +2
    -2
      common/JackDebugClient.cpp
  5. +1
    -1
      common/JackDebugClient.h
  6. +2
    -2
      common/JackInternalClient.cpp
  7. +1
    -1
      common/JackInternalClient.h
  8. +2
    -2
      common/JackLibClient.cpp
  9. +1
    -1
      common/JackLibClient.h
  10. +3
    -7
      common/JackServer.cpp
  11. +1
    -1
      posix/JackSocketClientChannel.cpp
  12. +1
    -1
      windows/JackWinNamedPipeClientChannel.cpp

+ 6
- 7
common/JackClient.cpp View File

@@ -88,13 +88,15 @@ JackClient::JackClient(JackSynchro* table):fThread(this)
JackClient::~JackClient() JackClient::~JackClient()
{} {}


void JackClient::ShutDown()
void JackClient::ShutDown(const char* message)
{ {
jack_log("JackClient::ShutDown"); jack_log("JackClient::ShutDown");
// If "fInfoShutdown" callback, then call it
if (fInfoShutdown) { if (fInfoShutdown) {
fInfoShutdown(JackFailure, "JACK server has been closed", fInfoShutdownArg);
fInfoShutdown(JackFailure, message, fInfoShutdownArg);
fInfoShutdown = NULL; fInfoShutdown = NULL;
// Otherwise possibly call the normal "fShutdown"
} else if (fShutdown) { } else if (fShutdown) {
fShutdown(fShutdownArg); fShutdown(fShutdownArg);
fShutdown = NULL; fShutdown = NULL;
@@ -296,10 +298,7 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,


case kShutDownCallback: case kShutDownCallback:
jack_log("JackClient::kShutDownCallback"); jack_log("JackClient::kShutDownCallback");
if (fInfoShutdown) {
fInfoShutdown((jack_status_t)value1, message, fInfoShutdownArg);
fInfoShutdown = NULL;
}
ShutDown(message);
break; break;


case kSessionCallback: case kSessionCallback:
@@ -660,7 +659,7 @@ inline void JackClient::Error()
fThread.DropSelfRealTime(); fThread.DropSelfRealTime();
GetClientControl()->fActive = false; GetClientControl()->fActive = false;
fChannel->ClientDeactivate(GetClientControl()->fRefNum, &result); fChannel->ClientDeactivate(GetClientControl()->fRefNum, &result);
ShutDown();
ShutDown(JACK_SERVER_FAILURE);
fThread.Terminate(); fThread.Terminate();
} }




+ 1
- 1
common/JackClient.h View File

@@ -143,7 +143,7 @@ class SERVER_EXPORT JackClient : public JackClientInterface, public JackRunnable
virtual int SetBufferSize(jack_nframes_t buffer_size); virtual int SetBufferSize(jack_nframes_t buffer_size);
virtual int SetFreeWheel(int onoff); virtual int SetFreeWheel(int onoff);
virtual int ComputeTotalLatencies(); virtual int ComputeTotalLatencies();
virtual void ShutDown();
virtual void ShutDown(const char* message);
virtual jack_native_thread_t GetThreadID(); virtual jack_native_thread_t GetThreadID();


// Port management // Port management


+ 2
- 0
common/JackConstants.h View File

@@ -75,6 +75,8 @@
#define FREEWHEEL_DRIVER_TIMEOUT 10 // in sec #define FREEWHEEL_DRIVER_TIMEOUT 10 // in sec
#define DRIVER_TIMEOUT_FACTOR 10 #define DRIVER_TIMEOUT_FACTOR 10


#define JACK_SERVER_FAILURE "JACK server has been closed"



#define NO_PORT 0xFFFE #define NO_PORT 0xFFFE




+ 2
- 2
common/JackDebugClient.cpp View File

@@ -363,10 +363,10 @@ ShutDown is called:
(Not needed since the synch object used (Sema of Fifo will fails when server quits... see ShutDown)) (Not needed since the synch object used (Sema of Fifo will fails when server quits... see ShutDown))
*/ */


void JackDebugClient::ShutDown()
void JackDebugClient::ShutDown(const char* message)
{ {
CheckClient("ShutDown"); CheckClient("ShutDown");
fClient->ShutDown();
fClient->ShutDown(message);
} }


//--------------------- //---------------------


+ 1
- 1
common/JackDebugClient.h View File

@@ -84,7 +84,7 @@ class JackDebugClient : public JackClient
int SetBufferSize(jack_nframes_t buffer_size); int SetBufferSize(jack_nframes_t buffer_size);
int SetFreeWheel(int onoff); int SetFreeWheel(int onoff);
int ComputeTotalLatencies(); int ComputeTotalLatencies();
void ShutDown();
void ShutDown(const char* message);
jack_native_thread_t GetThreadID(); jack_native_thread_t GetThreadID();


// Port management // Port management


+ 2
- 2
common/JackInternalClient.cpp View File

@@ -110,10 +110,10 @@ error:
return -1; return -1;
} }


void JackInternalClient::ShutDown()
void JackInternalClient::ShutDown(const char* message)
{ {
jack_log("JackInternalClient::ShutDown"); jack_log("JackInternalClient::ShutDown");
JackClient::ShutDown();
JackClient::ShutDown(message);
} }


JackGraphManager* JackInternalClient::GetGraphManager() const JackGraphManager* JackInternalClient::GetGraphManager() const


+ 1
- 1
common/JackInternalClient.h View File

@@ -47,7 +47,7 @@ class JackInternalClient : public JackClient
virtual ~JackInternalClient(); virtual ~JackInternalClient();


int Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status); int Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status);
void ShutDown();
void ShutDown(const char* message);


JackGraphManager* GetGraphManager() const; JackGraphManager* GetGraphManager() const;
JackEngineControl* GetEngineControl() const; JackEngineControl* GetEngineControl() const;


+ 2
- 2
common/JackLibClient.cpp View File

@@ -62,11 +62,11 @@ ShutDown is called:
(Not needed since the synch object used (Sema of Fifo will fails when server quits... see ShutDown)) (Not needed since the synch object used (Sema of Fifo will fails when server quits... see ShutDown))
*/ */


void JackLibClient::ShutDown()
void JackLibClient::ShutDown(const char* message)
{ {
jack_log("JackLibClient::ShutDown"); jack_log("JackLibClient::ShutDown");
JackGlobals::fServerRunning = false; JackGlobals::fServerRunning = false;
JackClient::ShutDown();
JackClient::ShutDown(message);
} }


JackLibClient::JackLibClient(JackSynchro* table): JackClient(table) JackLibClient::JackLibClient(JackSynchro* table): JackClient(table)


+ 1
- 1
common/JackLibClient.h View File

@@ -45,7 +45,7 @@ class JackLibClient : public JackClient
virtual ~JackLibClient(); virtual ~JackLibClient();


int Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status); int Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status);
void ShutDown();
void ShutDown(const char* message);


int ClientNotifyImp(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2); int ClientNotifyImp(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);




+ 3
- 7
common/JackServer.cpp View File

@@ -160,17 +160,13 @@ int JackServer::Start()
int JackServer::Stop() int JackServer::Stop()
{ {
jack_log("JackServer::Stop"); jack_log("JackServer::Stop");
int res = (fFreewheel) ? fThreadedFreewheelDriver->Stop() : fAudioDriver->Stop();
fEngine->NotifyQuit(); fEngine->NotifyQuit();
fRequestChannel.Stop(); fRequestChannel.Stop();
fEngine->NotifyFailure(JackFailure, JACK_SERVER_FAILURE);
fEngine->NotifyFailure(JackFailure, "JACK server has been closed");

if (fFreewheel) {
return fThreadedFreewheelDriver->Stop();
} else {
return fAudioDriver->Stop();
}
return res;
} }


bool JackServer::IsRunning() bool JackServer::IsRunning()


+ 1
- 1
posix/JackSocketClientChannel.cpp View File

@@ -146,7 +146,7 @@ bool JackSocketClientChannel::Execute()


error: error:
fNotificationSocket->Close(); fNotificationSocket->Close();
fClient->ShutDown();
fClient->ShutDown(JACK_SERVER_FAILURE);
return false; return false;
} }




+ 1
- 1
windows/JackWinNamedPipeClientChannel.cpp View File

@@ -150,7 +150,7 @@ error:
// Close the pipes, server wont be able to create them otherwise. // Close the pipes, server wont be able to create them otherwise.
fNotificationListenPipe.Close(); fNotificationListenPipe.Close();
fRequest->Close(); fRequest->Close();
fClient->ShutDown();
fClient->ShutDown(JACK_SERVER_FAILURE);
return false; return false;
} }




Loading…
Cancel
Save