Browse Source

Move ClientKill in JackEngine class.

tags/v1.9.10
Stephane Letz 12 years ago
parent
commit
feec982949
8 changed files with 34 additions and 27 deletions
  1. +16
    -6
      common/JackEngine.cpp
  2. +4
    -1
      common/JackEngine.h
  3. +7
    -0
      common/JackLockedEngine.h
  4. +1
    -13
      common/JackServer.cpp
  5. +1
    -2
      common/JackServer.h
  6. +3
    -3
      posix/JackSocketServerChannel.cpp
  7. +1
    -1
      windows/JackWinNamedPipeServerChannel.cpp
  8. +1
    -1
      windows/portaudio/JackPortAudioDriver.cpp

+ 16
- 6
common/JackEngine.cpp View File

@@ -107,7 +107,6 @@ void JackEngine::ShutDown()
}
}


void JackEngine::NotifyQuit()
{
fChannel.NotifyQuit();
@@ -128,9 +127,9 @@ int JackEngine::AllocateRefnum()
return -1;
}

void JackEngine::ReleaseRefnum(int ref)
void JackEngine::ReleaseRefnum(int refnum)
{
fClientTable[ref] = NULL;
fClientTable[refnum] = NULL;

if (fEngineControl->fTemporary) {
int i;
@@ -140,7 +139,7 @@ void JackEngine::ReleaseRefnum(int ref)
}
}
if (i == CLIENT_NUM) {
// last client and temporay case: quit the server
// Last client and temporay case: quit the server
jack_log("JackEngine::ReleaseRefnum server quit");
fEngineControl->fTemporary = false;
throw JackTemporaryException();
@@ -155,10 +154,10 @@ void JackEngine::ReleaseRefnum(int ref)
void JackEngine::ProcessNext(jack_time_t cur_cycle_begin)
{
fLastSwitchUsecs = cur_cycle_begin;
if (fGraphManager->RunNextGraph()) { // True if the graph actually switched to a new state
if (fGraphManager->RunNextGraph()) { // True if the graph actually switched to a new state
fChannel.Notify(ALL_CLIENTS, kGraphOrderCallback, 0);
}
fSignal.Signal(); // Signal for threads waiting for next cycle
fSignal.Signal(); // Signal for threads waiting for next cycle
}

void JackEngine::ProcessCurrent(jack_time_t cur_cycle_begin)
@@ -842,6 +841,17 @@ int JackEngine::ClientDeactivate(int refnum)
}
}

void JackEngine::ClientKill(int refnum)
{
jack_log("JackEngine::ClientKill ref = %ld", refnum);
if (ClientDeactivate(refnum) < 0) {
jack_error("JackServer::ClientKill ref = %ld cannot be removed from the graph !!", refnum);
}
if (ClientExternalClose(refnum) < 0) {
jack_error("JackServer::ClientKill ref = %ld cannot be closed", refnum);
}
}

//-----------------
// Port management
//-----------------


+ 4
- 1
common/JackEngine.h View File

@@ -74,7 +74,7 @@ class SERVER_EXPORT JackEngine : public JackLockAble
bool GenerateUniqueName(char* name);

int AllocateRefnum();
void ReleaseRefnum(int ref);
void ReleaseRefnum(int refnum);

int ClientNotify(JackClientInterface* client, int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
@@ -106,6 +106,7 @@ class SERVER_EXPORT JackEngine : public JackLockAble

// Client management
int ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status);
int ClientExternalOpen(const char* name, int pid, int uuid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager);
int ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait);

@@ -114,6 +115,8 @@ class SERVER_EXPORT JackEngine : public JackLockAble

int ClientActivate(int refnum, bool is_real_time);
int ClientDeactivate(int refnum);
void ClientKill(int refnum);

int GetClientPID(const char* name);
int GetClientRefNum(const char* name);


+ 7
- 0
common/JackLockedEngine.h View File

@@ -164,6 +164,13 @@ class SERVER_EXPORT JackLockedEngine
return (fEngine.CheckClient(refnum)) ? fEngine.ClientDeactivate(refnum) : -1;
CATCH_EXCEPTION_RETURN
}
void ClientKill(int refnum)
{
TRY_CALL
JackLock lock(&fEngine);
fEngine.ClientKill(refnum);
CATCH_EXCEPTION
}

// Internal client management
int GetInternalClientName(int int_ref, char* name_res)


+ 1
- 13
common/JackServer.cpp View File

@@ -53,8 +53,7 @@ JackServer::JackServer(bool sync, bool temporary, int timeout, bool rt, int prio
// regular freewheel driver because the freewheel driver needs to run in
// threaded mode when freewheel mode is active and needs to run as a slave
// when freewheel mode isn't active.
JackFreewheelDriver *freewheelDriver =
new JackFreewheelDriver(fEngine, GetSynchroTable());
JackFreewheelDriver* freewheelDriver = new JackFreewheelDriver(fEngine, GetSynchroTable());
fThreadedFreewheelDriver = new JackThreadedDriver(freewheelDriver);

fFreewheelDriver = freewheelDriver;
@@ -299,17 +298,6 @@ void JackServer::Notify(int refnum, int notify, int value)
}
}

void JackServer::ClientKill(int refnum)
{
jack_log("JackServer::ClientKill ref = %ld", refnum);
if (fEngine->ClientDeactivate(refnum) < 0) {
jack_error("JackServer::ClientKill ref = %ld cannot be removed from the graph !!", refnum);
}
if (fEngine->ClientExternalClose(refnum) < 0) {
jack_error("JackServer::ClientKill ref = %ld cannot be closed", refnum);
}
}

//----------------------
// Backend management
//----------------------


+ 1
- 2
common/JackServer.h View File

@@ -82,8 +82,7 @@ class SERVER_EXPORT JackServer
int SetFreewheel(bool onoff);
int InternalClientLoad1(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int uuid, int* status);
int InternalClientLoad2(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int uuid, int* status);
void ClientKill(int refnum);

// Transport management
int ReleaseTimebase(int refnum);
int SetTimebaseCallback(int refnum, int conditional);


+ 3
- 3
posix/JackSocketServerChannel.cpp View File

@@ -170,13 +170,13 @@ void JackSocketServerChannel::ClientKill(int fd)
int refnum = elem.first;
assert(socket);
jack_log("JackSocketServerChannel::ClientKill ref = %d fd = %d", refnum, fd);
if (refnum == -1) { // Should never happen... correspond to a client that started the socket but never opened...
jack_log("Client was not opened : probably correspond to server_check");
} else {
fServer->ClientKill(refnum);
fServer->GetEngine()->ClientKill(refnum);
}

jack_log("JackSocketServerChannel::ClientKill ref = %d fd = %d", refnum, fd);
fSocketTable.erase(fd);
socket->Close();
delete socket;


+ 1
- 1
windows/JackWinNamedPipeServerChannel.cpp View File

@@ -136,7 +136,7 @@ void JackClientPipeThread::ClientKill()
} else if (fRefNum == 0) { // Correspond to a still not opened client.
jack_log("Kill a not opened client %x", this);
} else {
fServer->ClientKill(fRefNum);
fServer->GetEngine()->ClientKill(fRefNum);
}

Close();


+ 1
- 1
windows/portaudio/JackPortAudioDriver.cpp View File

@@ -324,7 +324,7 @@ int JackPortAudioDriver::SetBufferSize(jack_nframes_t buffer_size)
goto error;
}
// It seems that some ASIO drivers (like ASIO4All needs this to restart correctly);
// It seems that some ASIO drivers (like ASIO4All) needs this to restart correctly;
delete fPaDevices;
fPaDevices = new PortAudioDevices();


Loading…
Cancel
Save