diff options
author | joq <joq@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2004-07-27 03:47:29 +0000 |
---|---|---|
committer | joq <joq@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2004-07-27 03:47:29 +0000 |
commit | c11a16d92f474a68e43b8c865162229f26e25829 (patch) | |
tree | 167a351240699bc206da26743ed18c9e500677dc /jackd | |
parent | bcaa13e4f50974d5922f39b1874d106ff922f3be (diff) | |
download | jack1-c11a16d92f474a68e43b8c865162229f26e25829.tar.gz |
[0.98.7] more threading fixes
git-svn-id: svn+ssh://jackaudio.org/trunk/jack@736 0c269be4-1314-0410-8aa9-9f06e86f4224
Diffstat (limited to 'jackd')
-rw-r--r-- | jackd/engine.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/jackd/engine.c b/jackd/engine.c index b3f86b4..fe2437e 100644 --- a/jackd/engine.c +++ b/jackd/engine.c @@ -2126,7 +2126,6 @@ jack_engine_new (int realtime, int rtpriority, int do_mlock, int temporary, (void) jack_get_fifo_fd (engine, 0); pthread_create (&engine->server_thread, 0, &jack_server_thread, engine); - pthread_detach (engine->server_thread); return engine; } @@ -2216,7 +2215,6 @@ jack_start_watchdog (jack_engine_t *engine) jack_error ("cannot start watchdog thread"); return -1; } - pthread_detach (engine->watchdog_thread); return 0; } @@ -2457,14 +2455,17 @@ jack_run_cycle (jack_engine_t *engine, jack_nframes_t nframes, return 0; } -int +void jack_engine_delete (jack_engine_t *engine) { int i; + if (engine == NULL) + return; + engine->control->engine_ok = 0; /* tell clients we're going away */ - if (engine && engine->driver) { + if (engine->driver) { jack_driver_t* driver = engine->driver; VERBOSE (engine, "stopping driver\n"); @@ -2487,19 +2488,17 @@ jack_engine_delete (jack_engine_t *engine) pthread_cancel (engine->server_thread); pthread_join (engine->server_thread, NULL); - /* JOQ: We need to cancel the watchdog thread and wait for it - * to terminate. For some reason, with the 2.6 kernel this - * causes a segfault in pthread_cancel(). I don't know why, - * but 2.4 works OK. - */ - VERBOSE (engine, "stopping watchdog thread\n"); - - /* Stephane Letz : letz@grame.fr - Watch dog thread is not needed on MacOSX since CoreAudio drivers already contains a similar mechanism. - */ #ifndef JACK_USE_MACH_THREADS - pthread_cancel (engine->watchdog_thread); - pthread_join (engine->watchdog_thread, NULL); + /* 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) { + VERBOSE (engine, "stopping watchdog thread\n"); + pthread_cancel (engine->watchdog_thread); + pthread_join (engine->watchdog_thread, NULL); + } #endif /* free engine control shm segment */ @@ -2512,7 +2511,6 @@ jack_engine_delete (jack_engine_t *engine) VERBOSE (engine, "engine deleted\n"); free (engine); - return 0; } /* Set up the engine's client internal and control structures for both |