Browse Source

In thread model, execute a dummy cycle to be sure thread has the correct properties (ensure thread creation is finished).

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1945 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.71
sletz 17 years ago
parent
commit
bfec95d99e
3 changed files with 24 additions and 15 deletions
  1. +1
    -0
      ChangeLog
  2. +1
    -2
      common/JackAPIWrapper.cpp
  3. +22
    -13
      common/JackClient.cpp

+ 1
- 0
ChangeLog View File

@@ -24,6 +24,7 @@ Nedko Arnaudov
* Fix engine real-time notification (was broken since ??).
* Correct jack_client_open_aux, jack_client_open and jack_client_new.
* Correct jack_internal_client_load for wrapper layer.
* In thread model, execute a dummy cycle to be sure thread has the correct properties (ensure thread creation is finished).

2008-03-10 Stephane Letz <letz@grame.fr>


+ 1
- 2
common/JackAPIWrapper.cpp View File

@@ -1106,7 +1106,7 @@ static bool check_client(void* library)
jack_client_close_fun = (jack_client_close_fun_def)dlsym(library, "jack_client_close");
// Try opening a client...
if ((client = (*jack_client_new_fun)("dummy"))) { // jackd server is running....
if ((client = (*jack_client_new_fun)("dummy"))) { // server is running....
printf("check_library 1 %x\n", jack_client_close_fun);
(*jack_client_close_fun)(client);
printf("check_library 2\n");
@@ -1167,7 +1167,6 @@ static bool init_library()
jack_is_realtime_fun = (jack_is_realtime_fun_def)dlsym(gLibrary, "jack_is_realtime");
jack_on_shutdown_fun = (jack_on_shutdown_fun_def)dlsym(gLibrary, "jack_on_shutdown");
jack_set_process_callback_fun = (jack_set_process_callback_fun_def)dlsym(gLibrary, "jack_set_process_callback");
jack_set_thread_init_callback_fun = (jack_set_thread_init_callback_fun_def)dlsym(gLibrary, "jack_set_thread_init_callback");
jack_set_freewheel_callback_fun = (jack_set_freewheel_callback_fun_def)dlsym(gLibrary, "jack_set_freewheel_callback");
jack_set_freewheel_fun = (jack_set_freewheel_fun_def)dlsym(gLibrary, "jack_set_freewheel");


+ 22
- 13
common/JackClient.cpp View File

@@ -342,6 +342,9 @@ int JackClient::StartThread()
bool JackClient::Execute()
{
if (fThreadFun) {
// Execute a dummy cycle to be sure thread has the correct properties (ensure thread creation is finished)
WaitSync();
SignalSync();
fThreadFun(fThreadFunArg);
} else {
if (WaitFirstSync())
@@ -406,18 +409,6 @@ jack_nframes_t JackClient::CycleWait()
return GetEngineControl()->fBufferSize;
}

int JackClient::SetProcessThread(JackThreadCallback fun, void *arg)
{
if (IsActive()) {
jack_error("You cannot set callbacks on an active client");
return -1;
} else {
fThreadFun = fun;
fThreadFunArg = arg;
return 0;
}
}

void JackClient::CycleSignal(int status)
{
if (status == 0)
@@ -803,7 +794,10 @@ int JackClient::SetProcessCallback(JackProcessCallback callback, void *arg)
if (IsActive()) {
jack_error("You cannot set callbacks on an active client");
return -1;
} else {
} else if (fThreadFun) {
jack_error ("A thread callback has already been setup, both models cannot be used at the same time!");
return -1;
} else {
fProcessArg = arg;
fProcess = callback;
return 0;
@@ -918,6 +912,21 @@ int JackClient::SetPortConnectCallback(JackPortConnectCallback callback, void *a
}
}

int JackClient::SetProcessThread(JackThreadCallback fun, void *arg)
{
if (IsActive()) {
jack_error("You cannot set callbacks on an active client");
return -1;
} else if (fProcess) {
jack_error ("A process callback has already been setup, both models cannot be used at the same time!");
return -1;
} else {
fThreadFun = fun;
fThreadFunArg = arg;
return 0;
}
}

//------------------
// Internal clients
//------------------


Loading…
Cancel
Save