fix: on join check if the thread is not waiting the current thread
This commit is contained in:
parent
bf8e6e9d0d
commit
25d2e181e1
@ -140,7 +140,7 @@ int thread_join(thread_t thread, void** retval)
|
|||||||
TRACE("Join thread %p", thread);
|
TRACE("Join thread %p", thread);
|
||||||
struct context_entry* entry = thread;
|
struct context_entry* entry = thread;
|
||||||
// Check if the target is not already waited by another
|
// 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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ int thread_join(thread_t thread, void** retval)
|
|||||||
*retval = entry->retvalue;
|
*retval = entry->retvalue;
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
TRACE("DEBUG %p,%d", entry, WAS_ALLOCATED(entry));
|
DBG("(entry, was_alloacted) : %p,%d", entry, WAS_ALLOCATED(entry));
|
||||||
if (WAS_ALLOCATED(entry)) {
|
if (WAS_ALLOCATED(entry)) {
|
||||||
VALGRIND_STACK_DEREGISTER(entry->valgrind_id);
|
VALGRIND_STACK_DEREGISTER(entry->valgrind_id);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user