Browse Source

Cleanup old zombification code.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1664 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.68
sletz 18 years ago
parent
commit
cc80ecb685
9 changed files with 16 additions and 80 deletions
  1. +1
    -0
      ChangeLog
  2. +1
    -5
      common/JackClient.cpp
  3. +0
    -2
      common/JackClientControl.h
  4. +2
    -57
      common/JackEngine.cpp
  5. +2
    -7
      common/JackEngine.h
  6. +1
    -2
      common/JackNotification.h
  7. +0
    -4
      common/JackServer.cpp
  8. +8
    -2
      macosx/Jackdmp.xcodeproj/project.pbxproj
  9. +1
    -1
      tests/jack_test.cpp

+ 1
- 0
ChangeLog View File

@@ -16,6 +16,7 @@ Tom Szilagyi
2007-10-26 Stephane Letz <letz@grame.fr> 2007-10-26 Stephane Letz <letz@grame.fr>


* Add midiseq and midisine examples. * Add midiseq and midisine examples.
* Cleanup old zombification code.


2007-10-25 Stephane Letz <letz@grame.fr> 2007-10-25 Stephane Letz <letz@grame.fr>




+ 1
- 5
common/JackClient.cpp View File

@@ -25,7 +25,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackEngineControl.h" #include "JackEngineControl.h"
#include "JackGlobals.h" #include "JackGlobals.h"
#include "JackChannel.h" #include "JackChannel.h"
#include "JackTransportEngine.h"
#include "JackTransportEngine.h"
#include "driver_interface.h" #include "driver_interface.h"
#include <math.h> #include <math.h>
#include <string> #include <string>
@@ -210,10 +210,6 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,
res = fXrun(fXrunArg); res = fXrun(fXrunArg);
break; break;


case kZombifyClient:
JackLog("JackClient::kZombifyClient name = %s ref = %ld \n", name, refnum);
ShutDown();
break;
} }
} }




+ 0
- 2
common/JackClientControl.h View File

@@ -40,7 +40,6 @@ struct JackClientControl : public JackShmMem
bool fCallback[kMaxNotification]; bool fCallback[kMaxNotification];
volatile jack_transport_state_t fTransportState; volatile jack_transport_state_t fTransportState;
int fRefNum; int fRefNum;
bool fZombie;
bool fActive; bool fActive;


JackClientControl(const char* name, int refnum) JackClientControl(const char* name, int refnum)
@@ -69,7 +68,6 @@ struct JackClientControl : public JackShmMem
fCallback[kActivateClient] = true; fCallback[kActivateClient] = true;
fRefNum = refnum; fRefNum = refnum;
fTransportState = JackTransportStopped; fTransportState = JackTransportStopped;
fZombie = false;
fActive = false; fActive = false;
} }




+ 2
- 57
common/JackEngine.cpp View File

@@ -160,8 +160,7 @@ bool JackEngine::Process(jack_time_t callback_usecs)
JackLog("Process: graph not finished!\n"); JackLog("Process: graph not finished!\n");
if (callback_usecs > fLastSwitchUsecs + fEngineControl->fTimeOutUsecs) { if (callback_usecs > fLastSwitchUsecs + fEngineControl->fTimeOutUsecs) {
JackLog("Process: switch to next state delta = %ld\n", long(callback_usecs - fLastSwitchUsecs)); JackLog("Process: switch to next state delta = %ld\n", long(callback_usecs - fLastSwitchUsecs));
//RemoveZombifiedClients(callback_usecs); TODO
ProcessNext(callback_usecs);
ProcessNext(callback_usecs);
res = true; res = true;
} else { } else {
JackLog("Process: waiting to switch delta = %ld\n", long(callback_usecs - fLastSwitchUsecs)); JackLog("Process: waiting to switch delta = %ld\n", long(callback_usecs - fLastSwitchUsecs));
@@ -192,71 +191,17 @@ void JackEngine::CheckXRun(jack_time_t callback_usecs) // REVOIR les conditions
if (status != NotTriggered && status != Finished) { if (status != NotTriggered && status != Finished) {
jack_error("JackEngine::XRun: client = %s was not run: state = %ld", client->GetClientControl()->fName, status); jack_error("JackEngine::XRun: client = %s was not run: state = %ld", client->GetClientControl()->fName, status);
//fChannel->ClientNotify(i, kXRunCallback, 0); // Notify the failing client
fChannel->ClientNotify(ALL_CLIENTS, kXRunCallback, 0); // Notify all clients fChannel->ClientNotify(ALL_CLIENTS, kXRunCallback, 0); // Notify all clients
} }
if (status == Finished && (long)(finished_date - callback_usecs) > 0) { if (status == Finished && (long)(finished_date - callback_usecs) > 0) {
jack_error("JackEngine::XRun: client %s finished after current callback", client->GetClientControl()->fName); jack_error("JackEngine::XRun: client %s finished after current callback", client->GetClientControl()->fName);
//fChannel->ClientNotify(i, kXRunCallback, 0); // Notify the failing client
fChannel->ClientNotify(ALL_CLIENTS, kXRunCallback, 0); // Notify all clients fChannel->ClientNotify(ALL_CLIENTS, kXRunCallback, 0); // Notify all clients
} }
} }
} }
} }


//---------------
// Zombification
//---------------

bool JackEngine::IsZombie(JackClientInterface* client, jack_time_t current_time)
{
return ((current_time - fGraphManager->GetClientTiming(client->GetClientControl()->fRefNum)->fFinishedAt) > 2 * fEngineControl->fTimeOutUsecs); // A VERIFIER
}

// TODO : check what happens with looped sub-graph....
void JackEngine::GetZombifiedClients(bool zombi_clients[CLIENT_NUM], jack_time_t current_time)
{
for (int i = REAL_REFNUM; i < CLIENT_NUM; i++) {
JackClientInterface* client1 = fClientTable[i];
if (client1 && IsZombie(client1, current_time)) {
JackLog("JackEngine::GetZombifiedClients: %s\n", client1->GetClientControl()->fName);
zombi_clients[i] = true; // Assume client is dead
// If another dead client is connected to the scanned one, then the scanned one is not the first of the dead subgraph
for (int j = REAL_REFNUM; j < CLIENT_NUM; j++) {
JackClientInterface* client2 = fClientTable[j];
if (client2 && IsZombie(client2, current_time) && fGraphManager->IsDirectConnection(j, i)) {
zombi_clients[i] = false;
break;
}
}
} else {
zombi_clients[i] = false;
}
}
}

void JackEngine::RemoveZombifiedClients(jack_time_t current_time)
{
bool zombi_clients[CLIENT_NUM];
GetZombifiedClients(zombi_clients, current_time);

for (int i = REAL_REFNUM; i < CLIENT_NUM; i++) {
if (zombi_clients[i] && !fClientTable[i]->GetClientControl()->fZombie) {
fClientTable[i]->GetClientControl()->fZombie = true;
JackLog("RemoveZombifiedCients: name = %s\n", fClientTable[i]->GetClientControl()->fName);
fGraphManager->DirectDisconnect(FREEWHEEL_DRIVER_REFNUM, i);
fGraphManager->DirectDisconnect(i, FREEWHEEL_DRIVER_REFNUM);
fGraphManager->DisconnectAllPorts(i);
fChannel->ClientNotify(i, kZombifyClient, 0); // Signal engine
}
}
}

void JackEngine::ZombifyClient(int refnum)
{
NotifyClient(refnum, kZombifyClient, false, 0);
}

//--------------- //---------------
// Notifications // Notifications
//--------------- //---------------


+ 2
- 7
common/JackEngine.h View File

@@ -55,11 +55,7 @@ class JackEngine
int NotifyAddClient(JackClientInterface* new_client, const char* name, int refnum); int NotifyAddClient(JackClientInterface* new_client, const char* name, int refnum);
void NotifyRemoveClient(const char* name, int refnum); void NotifyRemoveClient(const char* name, int refnum);
bool IsZombie(JackClientInterface* client, jack_time_t current_time);
void RemoveZombifiedClients(jack_time_t current_time);
void GetZombifiedClients(bool clients[CLIENT_NUM], jack_time_t current_time);
void ProcessNext(jack_time_t callback_usecs); void ProcessNext(jack_time_t callback_usecs);
void ProcessCurrent(jack_time_t callback_usecs); void ProcessCurrent(jack_time_t callback_usecs);
@@ -109,8 +105,7 @@ class JackEngine


// Graph // Graph
bool Process(jack_time_t callback_usecs); bool Process(jack_time_t callback_usecs);
void ZombifyClient(int refnum);

// Notifications // Notifications
void NotifyClient(int refnum, int event, int sync, int value); void NotifyClient(int refnum, int event, int sync, int value);
void NotifyClients(int event, int sync, int value); void NotifyClients(int event, int sync, int value);


+ 1
- 2
common/JackNotification.h View File

@@ -33,8 +33,7 @@ namespace Jack
kStopFreewheelCallback = 7, kStopFreewheelCallback = 7,
kPortRegistrationOnCallback = 8, kPortRegistrationOnCallback = 8,
kPortRegistrationOffCallback = 9, kPortRegistrationOffCallback = 9,
kZombifyClient = 10,
kDeadClient = 11,
kDeadClient = 10,
kMaxNotification kMaxNotification
}; };




+ 0
- 4
common/JackServer.cpp View File

@@ -287,10 +287,6 @@ void JackServer::Notify(int refnum, int notify, int value)
fEngine->NotifyXRun(refnum); fEngine->NotifyXRun(refnum);
break; break;


case kZombifyClient:
fEngine->ZombifyClient(refnum);
break;

case kDeadClient: case kDeadClient:
JackLog("JackServer: kDeadClient ref = %ld\n", refnum); JackLog("JackServer: kDeadClient ref = %ld\n", refnum);
if (fEngine->ClientDeactivate(refnum) < 0) if (fEngine->ClientDeactivate(refnum) < 0)


+ 8
- 2
macosx/Jackdmp.xcodeproj/project.pbxproj View File

@@ -312,14 +312,14 @@
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
proxyType = 1; proxyType = 1;
remoteGlobalIDString = 4B5A1BB10CD1CB9E0005BF74 /* jack_midiseq */;
remoteGlobalIDString = 4B5A1BB10CD1CB9E0005BF74;
remoteInfo = jack_midiseq; remoteInfo = jack_midiseq;
}; };
4B5A1BE10CD1CD730005BF74 /* PBXContainerItemProxy */ = { 4B5A1BE10CD1CD730005BF74 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
proxyType = 1; proxyType = 1;
remoteGlobalIDString = 4B5A1BD00CD1CCE10005BF74 /* jack_midisine */;
remoteGlobalIDString = 4B5A1BD00CD1CCE10005BF74;
remoteInfo = jack_midisine; remoteInfo = jack_midisine;
}; };
4B699DB3097D421700A18468 /* PBXContainerItemProxy */ = { 4B699DB3097D421700A18468 /* PBXContainerItemProxy */ = {
@@ -520,6 +520,9 @@
4B5A1BBD0CD1CC110005BF74 /* midiseq.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = midiseq.c; path = "../example-clients/midiseq.c"; sourceTree = SOURCE_ROOT; }; 4B5A1BBD0CD1CC110005BF74 /* midiseq.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = midiseq.c; path = "../example-clients/midiseq.c"; sourceTree = SOURCE_ROOT; };
4B5A1BDA0CD1CCE10005BF74 /* jack_midisine */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midisine; sourceTree = BUILT_PRODUCTS_DIR; }; 4B5A1BDA0CD1CCE10005BF74 /* jack_midisine */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_midisine; sourceTree = BUILT_PRODUCTS_DIR; };
4B5A1BDC0CD1CD420005BF74 /* midisine.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = midisine.c; path = "../example-clients/midisine.c"; sourceTree = SOURCE_ROOT; }; 4B5A1BDC0CD1CD420005BF74 /* midisine.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = midisine.c; path = "../example-clients/midisine.c"; sourceTree = SOURCE_ROOT; };
4B5A1D3C0CD1F4990005BF74 /* FadeConnect.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = FadeConnect.cpp; path = "../example-clients/FadeConnect.cpp"; sourceTree = SOURCE_ROOT; };
4B5A1D3D0CD1F4990005BF74 /* FadeConnect.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FadeConnect.h; path = "../example-clients/FadeConnect.h"; sourceTree = SOURCE_ROOT; };
4B5A1D700CD1F63F0005BF74 /* fade_connect.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = fade_connect.cpp; path = "../example-clients/fade_connect.cpp"; sourceTree = SOURCE_ROOT; };
4B60CE480AAABA31004956AA /* connect.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = connect.c; path = "../example-clients/connect.c"; sourceTree = SOURCE_ROOT; }; 4B60CE480AAABA31004956AA /* connect.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = connect.c; path = "../example-clients/connect.c"; sourceTree = SOURCE_ROOT; };
4B66A8580934964500A89560 /* JackConstants.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackConstants.h; path = ../common/JackConstants.h; sourceTree = SOURCE_ROOT; }; 4B66A8580934964500A89560 /* JackConstants.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackConstants.h; path = ../common/JackConstants.h; sourceTree = SOURCE_ROOT; };
4B699BB1097D421600A18468 /* jackdmp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jackdmp; sourceTree = BUILT_PRODUCTS_DIR; }; 4B699BB1097D421600A18468 /* jackdmp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jackdmp; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -959,6 +962,9 @@
4B03383E0797E19900686131 /* Simple clients */ = { 4B03383E0797E19900686131 /* Simple clients */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
4B5A1D700CD1F63F0005BF74 /* fade_connect.cpp */,
4B5A1D3C0CD1F4990005BF74 /* FadeConnect.cpp */,
4B5A1D3D0CD1F4990005BF74 /* FadeConnect.h */,
4B5A1BDC0CD1CD420005BF74 /* midisine.c */, 4B5A1BDC0CD1CD420005BF74 /* midisine.c */,
4B5A1BBD0CD1CC110005BF74 /* midiseq.c */, 4B5A1BBD0CD1CC110005BF74 /* midiseq.c */,
4BA692D60CBE4CC600EAD520 /* ipunload.c */, 4BA692D60CBE4CC600EAD520 /* ipunload.c */,


+ 1
- 1
tests/jack_test.cpp View File

@@ -480,7 +480,7 @@ int main (int argc, char *argv[])
const char *options = "kRnqvt:"; const char *options = "kRnqvt:";
float ratio; // for speed calculation in freewheel mode float ratio; // for speed calculation in freewheel mode
jack_options_t jack_options = JackNullOption; jack_options_t jack_options = JackNullOption;
struct option long_options[] = {
struct option long_options[] = {
{"realtime", 0, 0, 'R'}, {"realtime", 0, 0, 'R'},
{"non-realtime", 0, 0, 'n'}, {"non-realtime", 0, 0, 'n'},
{"time", 0, 0, 't'}, {"time", 0, 0, 't'},


Loading…
Cancel
Save