summaryrefslogtreecommitdiffstats
path: root/libdimension/threads.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/threads.c')
-rw-r--r--libdimension/threads.c6
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);
}
}