Browse Source

[engine] make jack_check_clients return errs. when no err, read graph_wait

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-9f06e86f4224
tags/0.121.0
torben 14 years ago
parent
commit
009ebad4af
3 changed files with 22 additions and 17 deletions
  1. +6
    -2
      jackd/clientengine.c
  2. +1
    -1
      jackd/clientengine.h
  3. +15
    -14
      jackd/engine.c

+ 6
- 2
jackd/clientengine.c View File

@@ -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)
{
/* 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;
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);
}

if (client->control->finished_at == 0) {
client->control->timed_out++;
client->error++;
errs++;
VERBOSE (engine, "client %s has timed out", client->control->name);
} else {
/*
@@ -302,6 +304,8 @@ jack_check_clients (jack_engine_t* engine, int with_timeout_check)
if (errs) {
jack_engine_signal_problems (engine);
}

return errs;
}

void


+ 1
- 1
jackd/clientengine.h View File

@@ -58,7 +58,7 @@ void jack_intclient_name_request (jack_engine_t *engine,
jack_request_t *req);
void jack_intclient_unload_request (jack_engine_t *engine,
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_client_registration_notify (jack_engine_t *engine,
const char* name, int yn);


+ 15
- 14
jackd/engine.c View File

@@ -799,23 +799,25 @@ jack_process_external(jack_engine_t *engine, JSList *node)
ctl->finished_at? (ctl->finished_at -
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 {
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) */
@@ -2445,7 +2447,6 @@ jack_run_one_cycle (jack_engine_t *engine, jack_nframes_t nframes,
DEBUG("run process\n");

if (jack_engine_process (engine, nframes) != 0) {
engine->continuous_stream = 0;
DEBUG ("engine process cycle failed");
jack_check_client_status (engine);
}


Loading…
Cancel
Save