From ff9a69c6a49553e6e4cc2a2fd87d700423bf5ffd Mon Sep 17 00:00:00 2001 From: Jacob Garby Date: Wed, 10 Apr 2024 14:23:03 +0200 Subject: [PATCH] fix the possibility for pthread_detach(0) --- deps/worker.c | 2 +- neco.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/worker.c b/deps/worker.c index 44e2b8e..4b8af23 100644 --- a/deps/worker.c +++ b/deps/worker.c @@ -144,10 +144,10 @@ static void *worker_entry(void *arg) { ts.tv_sec += 1; pthread_cond_timedwait(&thread->cond, &thread->mu, &ts); if (thread->len == 0) { - thread->th = 0; if (!thread->end) { pthread_detach(thread->th); } + thread->th = 0; thread->end = false; break; } diff --git a/neco.c b/neco.c index 322265c..51d8110 100644 --- a/neco.c +++ b/neco.c @@ -2739,10 +2739,10 @@ static void *worker_entry(void *arg) { ts.tv_sec += 1; pthread_cond_timedwait(&thread->cond, &thread->mu, &ts); if (thread->len == 0) { - thread->th = 0; if (!thread->end) { pthread_detach(thread->th); } + thread->th = 0; thread->end = false; break; }