Browse Source

remove watchdog thread from engine/jackd, since Linux no longer allows SCHED_{FIFO,RR} tasks to take over the cpu unless the user misconfigures a very obscure part of their system configuration

tags/0.124.0
Paul Davis 12 years ago
parent
commit
6e4d80815b
7 changed files with 3 additions and 121 deletions
  1. +1
    -1
      example-clients
  2. +0
    -3
      include/engine.h
  3. +0
    -1
      jackd/controlapi.c
  4. +0
    -106
      jackd/engine.c
  5. +1
    -3
      jackd/jackd.1.in
  6. +0
    -6
      jackd/jackd.c
  7. +1
    -1
      tools

+ 1
- 1
example-clients

@@ -1 +1 @@
Subproject commit 7c2f9ee5f839f48abaf3072f161286a0af4ab297
Subproject commit b952e1e5f1e280ed45094273a12e996fc26081c7

+ 0
- 3
include/engine.h View File

@@ -105,7 +105,6 @@ struct _jack_engine {

unsigned int port_max;
pthread_t server_thread;
pthread_t watchdog_thread;

int fds[2];
int cleanup_fifo[2];
@@ -132,7 +131,6 @@ struct _jack_engine {
const char *server_name;
char temporary;
int reordered;
int watchdog_check;
int feedbackcount;
int removing_clients;
pid_t wait_pid;
@@ -258,7 +256,6 @@ jack_client_internal_t *
jack_client_by_name (jack_engine_t *engine, const char *name);

int jack_deliver_event (jack_engine_t *, jack_client_internal_t *, jack_event_t *);
void jack_stop_watchdog (jack_engine_t * );

void
jack_engine_signal_problems (jack_engine_t* engine);


+ 0
- 1
jackd/controlapi.c View File

@@ -1507,7 +1507,6 @@ bool jackctl_server_switch_master(jackctl_server_t * server_ptr, jackctl_driver_
jack_unlock_graph (server_ptr->engine);
pthread_mutex_unlock (&server_ptr->engine->request_lock);

jack_stop_watchdog (server_ptr->engine);
server_ptr->engine->driver = NULL;

jack_driver_unload (old_driver);


+ 0
- 106
jackd/engine.c View File

@@ -835,7 +835,6 @@ jack_engine_process (jack_engine_t *engine, jack_nframes_t nframes)
JSList *node;

engine->process_errors = 0;
engine->watchdog_check = 1;

for (node = engine->clients; node; node = jack_slist_next (node)) {
jack_client_control_t *ctl =
@@ -932,102 +931,6 @@ jack_engine_post_process (jack_engine_t *engine)
jack_check_clients (engine, 0);
}

#ifdef JACK_USE_MACH_THREADS

static int
jack_start_watchdog (jack_engine_t *engine)
{
/* Stephane Letz : letz@grame.fr Watch dog thread is
* not needed on MacOSX since CoreAudio drivers
* already contains a similar mechanism.
*/
return 0;
}

void
jack_stop_watchdog (jack_engine_t *engine)
{
/* Stephane Letz : letz@grame.fr Watch dog thread is
* not needed on MacOSX since CoreAudio drivers
* already contains a similar mechanism.
*/
return;
}

#else

static void *
jack_watchdog_thread (void *arg)
{
jack_engine_t *engine = (jack_engine_t *) arg;
struct timespec timo;

timo.tv_sec = JACKD_WATCHDOG_TIMEOUT / 1000;
timo.tv_nsec = (JACKD_WATCHDOG_TIMEOUT - (timo.tv_sec * 1000)) * 1000;
engine->watchdog_check = 0;

while (1) {
nanosleep (&timo, NULL);
if (!engine->freewheeling && engine->watchdog_check == 0) {

jack_error ("jackd watchdog: timeout - killing jackd");

/* Kill the current client (guilt by association). */
if (engine->current_client) {
kill (engine->current_client->
control->pid, SIGKILL);
}

/* kill our process group, try to get a dump */
kill (-getpgrp(), SIGABRT);
/*NOTREACHED*/
exit (1);
}
engine->watchdog_check = 0;
}
}

static int
jack_start_watchdog (jack_engine_t *engine)
{
int watchdog_priority = engine->rtpriority + 10;
#ifndef __OpenBSD__
int max_priority = sched_get_priority_max (SCHED_FIFO);
#else
int max_priority = -1;
#endif

if ((max_priority != -1) &&
(max_priority < watchdog_priority))
watchdog_priority = max_priority;
if (jack_client_create_thread (NULL, &engine->watchdog_thread, watchdog_priority,
TRUE, jack_watchdog_thread, engine)) {
jack_error ("cannot start watchdog thread");
return -1;
}

return 0;
}

void
jack_stop_watchdog (jack_engine_t *engine)
{
/* Cancel the watchdog thread and wait for it to terminate.
*
* The watchdog thread is not used on MacOSX since CoreAudio
* drivers already contain a similar mechanism.
*/
if (engine->control->real_time && engine->watchdog_thread) {
VERBOSE (engine, "stopping watchdog thread");
pthread_cancel (engine->watchdog_thread);
pthread_join (engine->watchdog_thread, NULL);
}

return;
}
#endif /* !JACK_USE_MACH_THREADS */


static jack_driver_info_t *
jack_load_driver (jack_engine_t *engine, jack_driver_desc_t * driver_desc)
@@ -1130,12 +1033,6 @@ jack_engine_load_driver (jack_engine_t *engine,
engine->driver_desc = driver_desc;
engine->driver_params = driver_params;

if (engine->control->real_time) {
if (jack_start_watchdog (engine)) {
return -1;
}
engine->watchdog_check = 1;
}
return 0;
}

@@ -1869,7 +1766,6 @@ jack_engine_new (int realtime, int rtpriority, int do_mlock, int do_unlock,
engine->next_client_id = 1; /* 0 is a NULL client ID */
engine->port_max = port_max;
engine->server_thread = 0;
engine->watchdog_thread = 0;
engine->rtpriority = rtpriority;
engine->silent_buffer = 0;
engine->verbose = verbose;
@@ -2667,8 +2563,6 @@ jack_engine_delete (jack_engine_t *engine)
pthread_join (engine->server_thread, NULL);
#endif

jack_stop_watchdog (engine);


VERBOSE (engine, "last xrun delay: %.3f usecs",
engine->control->xrun_delayed_usecs);


+ 1
- 3
jackd/jackd.1.in View File

@@ -97,13 +97,11 @@ Exit once all clients have closed their connections.
\fB\-t, \-\-timeout \fIint\fR
.br
Set client timeout limit in milliseconds. The default is 500 msec.
In realtime mode the client timeout must be smaller than the watchdog timeout (5000 msec).
.TP
\fB\-Z, \-\-nozombies\fR
.br
Prevent JACK from ever kicking out clients because they were too slow.
This cancels the effect any specified timeout value, but JACK and its clients are
still subject to the supervision of the watchdog thread or its equivalent.
This cancels the effect any specified timeout value.
.TP
\fB\-C, \-\-timeout-thres \fItime\fR
.br


+ 0
- 6
jackd/jackd.c View File

@@ -715,12 +715,6 @@ main (int argc, char *argv[])
return -1;
}

if (realtime && (client_timeout >= JACKD_WATCHDOG_TIMEOUT)) {
usage (stderr);
fprintf (stderr, "In realtime mode (-R) the client timeout must be smaller than the watchdog timeout (%ims).\n", JACKD_WATCHDOG_TIMEOUT);
exit (1);
}

if (!seen_driver) {
usage (stderr);
exit (1);


+ 1
- 1
tools

@@ -1 +1 @@
Subproject commit 2a400f42147f41206b31d7750558e4b3d0293f08
Subproject commit f8efbd5838fb2b1c9ed4eff55ef4ffff40bdf708

Loading…
Cancel
Save