diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-08-19 08:41:53 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-08-19 08:41:53 -0600 |
commit | 4f9a96f6cdee4cf234bde7fdafd0be0f5b6b808e (patch) | |
tree | 78bc047797262d2447086f31efe3996ac1ae096a /libdimension/threads.c | |
parent | c0284b69fe0ee82d1f604a1b6f0511b4f129b919 (diff) | |
download | dimension-4f9a96f6cdee4cf234bde7fdafd0be0f5b6b808e.tar.xz |
Cancel all ccthreads first before joining them on cleanup.
Diffstat (limited to 'libdimension/threads.c')
-rw-r--r-- | libdimension/threads.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libdimension/threads.c b/libdimension/threads.c index d4bddd3..4cefdd5 100644 --- a/libdimension/threads.c +++ b/libdimension/threads.c @@ -100,9 +100,15 @@ static void dmnsn_ccthread_cleanup(void *ptr) { dmnsn_ccthread_cleanup_payload *payload = ptr; + for (unsigned int i = 0; i < payload->nthreads; ++i) { if (payload->payloads[i].started) { pthread_cancel(payload->threads[i]); + } + } + + for (unsigned int i = 0; i < payload->nthreads; ++i) { + if (payload->payloads[i].started) { dmnsn_join_thread(payload->threads[i], NULL); } } |