From 25d2e181e1e0e77418db67cc91f01330be7b3288 Mon Sep 17 00:00:00 2001 From: Martin Eyben Date: Mon, 24 Mar 2025 15:21:14 +0100 Subject: [PATCH] fix: on join check if the thread is not waiting the current thread --- src/thread/thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thread/thread.c b/src/thread/thread.c index adba9e8..c6a2d11 100644 --- a/src/thread/thread.c +++ b/src/thread/thread.c @@ -140,7 +140,7 @@ int thread_join(thread_t thread, void** retval) TRACE("Join thread %p", thread); struct context_entry* entry = thread; // Check if the target is not already waited by another - if (IS_WAITED(entry) || IS_WAITING(entry) && GET_WAITING_THREAD(entry) != running) { + if (IS_WAITED(entry) || IS_WAITING(entry) && GET_WAITING_THREAD(entry) == running) { return -1; } @@ -165,7 +165,7 @@ int thread_join(thread_t thread, void** retval) *retval = entry->retvalue; // Clean up - TRACE("DEBUG %p,%d", entry, WAS_ALLOCATED(entry)); + DBG("(entry, was_alloacted) : %p,%d", entry, WAS_ALLOCATED(entry)); if (WAS_ALLOCATED(entry)) { VALGRIND_STACK_DEREGISTER(entry->valgrind_id); }