if jack_check_clients does not find a bad client, we need to read the graph_wait_fd. otherwise we end up with too many execution tokens floating around. this commit also fixes the reset of the continuous stream and makes the mercysleep use ms instead of ns. git-svn-id: svn+ssh://jackaudio.org/trunk/jack@4430 0c269be4-1314-0410-8aa9-9f06e86f4224tags/0.121.0
@@ -237,7 +237,7 @@ jack_remove_client (jack_engine_t *engine, jack_client_internal_t *client) | |||||
} | } | ||||
} | } | ||||
void | |||||
int | |||||
jack_check_clients (jack_engine_t* engine, int with_timeout_check) | jack_check_clients (jack_engine_t* engine, int with_timeout_check) | ||||
{ | { | ||||
/* CALLER MUST HOLD graph read lock */ | /* CALLER MUST HOLD graph read lock */ | ||||
@@ -278,13 +278,15 @@ jack_check_clients (jack_engine_t* engine, int with_timeout_check) | |||||
*/ | */ | ||||
struct timespec wait_time; | struct timespec wait_time; | ||||
wait_time.tv_sec = 0; | wait_time.tv_sec = 0; | ||||
wait_time.tv_nsec = engine->driver->period_usecs - (now - client->control->awake_at); | |||||
wait_time.tv_nsec = (engine->driver->period_usecs - (now - client->control->awake_at)) * 1000; | |||||
VERBOSE (engine, "client %s seems to have timed out. we may have mercy of %d ns." , client->control->name, (int) wait_time.tv_nsec ); | |||||
nanosleep (&wait_time, NULL); | nanosleep (&wait_time, NULL); | ||||
} | } | ||||
if (client->control->finished_at == 0) { | if (client->control->finished_at == 0) { | ||||
client->control->timed_out++; | client->control->timed_out++; | ||||
client->error++; | client->error++; | ||||
errs++; | |||||
VERBOSE (engine, "client %s has timed out", client->control->name); | VERBOSE (engine, "client %s has timed out", client->control->name); | ||||
} else { | } else { | ||||
/* | /* | ||||
@@ -302,6 +304,8 @@ jack_check_clients (jack_engine_t* engine, int with_timeout_check) | |||||
if (errs) { | if (errs) { | ||||
jack_engine_signal_problems (engine); | jack_engine_signal_problems (engine); | ||||
} | } | ||||
return errs; | |||||
} | } | ||||
void | void | ||||
@@ -58,7 +58,7 @@ void jack_intclient_name_request (jack_engine_t *engine, | |||||
jack_request_t *req); | jack_request_t *req); | ||||
void jack_intclient_unload_request (jack_engine_t *engine, | void jack_intclient_unload_request (jack_engine_t *engine, | ||||
jack_request_t *req); | jack_request_t *req); | ||||
void jack_check_clients (jack_engine_t* engine, int with_timeout_check); | |||||
int jack_check_clients (jack_engine_t* engine, int with_timeout_check); | |||||
void jack_remove_clients (jack_engine_t* engine, int* exit_freewheeling); | void jack_remove_clients (jack_engine_t* engine, int* exit_freewheeling); | ||||
void jack_client_registration_notify (jack_engine_t *engine, | void jack_client_registration_notify (jack_engine_t *engine, | ||||
const char* name, int yn); | const char* name, int yn); | ||||
@@ -799,23 +799,25 @@ jack_process_external(jack_engine_t *engine, JSList *node) | |||||
ctl->finished_at? (ctl->finished_at - | ctl->finished_at? (ctl->finished_at - | ||||
ctl->signalled_at): 0); | ctl->signalled_at): 0); | ||||
jack_check_clients (engine, 1); | |||||
engine->process_errors++; | |||||
return NULL; /* will stop the loop */ | |||||
if (jack_check_clients (engine, 1)) { | |||||
engine->process_errors++; | |||||
return NULL; /* will stop the loop */ | |||||
} | |||||
} else { | } else { | ||||
engine->continuous_stream = 0; | |||||
} | |||||
DEBUG ("reading byte from subgraph_wait_fd==%d", | |||||
client->subgraph_wait_fd); | |||||
if (read (client->subgraph_wait_fd, &c, sizeof(c)) | |||||
!= sizeof (c)) { | |||||
jack_error ("pp: cannot clean up byte from graph wait " | |||||
"fd (%s)", strerror (errno)); | |||||
client->error++; | |||||
return NULL; /* will stop the loop */ | |||||
} | |||||
DEBUG ("reading byte from subgraph_wait_fd==%d", | |||||
client->subgraph_wait_fd); | |||||
if (read (client->subgraph_wait_fd, &c, sizeof(c)) | |||||
!= sizeof (c)) { | |||||
jack_error ("pp: cannot clean up byte from graph wait " | |||||
"fd (%s)", strerror (errno)); | |||||
client->error++; | |||||
return NULL; /* will stop the loop */ | |||||
} | } | ||||
/* Move to next internal client (or end of client list) */ | /* Move to next internal client (or end of client list) */ | ||||
@@ -2445,7 +2447,6 @@ jack_run_one_cycle (jack_engine_t *engine, jack_nframes_t nframes, | |||||
DEBUG("run process\n"); | DEBUG("run process\n"); | ||||
if (jack_engine_process (engine, nframes) != 0) { | if (jack_engine_process (engine, nframes) != 0) { | ||||
engine->continuous_stream = 0; | |||||
DEBUG ("engine process cycle failed"); | DEBUG ("engine process cycle failed"); | ||||
jack_check_client_status (engine); | jack_check_client_status (engine); | ||||
} | } | ||||