From 86f57dad0b98ab6acbf0a393d2acc488ed3f7d8b Mon Sep 17 00:00:00 2001 From: Salikh Zakirov Date: Tue, 20 Mar 2007 21:32:46 +0300 Subject: [PATCH] hythread_cancel(): detach a cancelled thread --- vm/thread/src/thread_native_basic.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vm/thread/src/thread_native_basic.c b/vm/thread/src/thread_native_basic.c index ec4bc89..0ca5080 100644 --- a/vm/thread/src/thread_native_basic.c +++ b/vm/thread/src/thread_native_basic.c @@ -265,8 +265,10 @@ void VMCALL hythread_detach(hythread_t thread) { // No actions required in case the specified thread is detached already. if (thread->group != NULL) { - assert(thread == tm_self_tls); - + + // the thread can be detached from the other thread in case + // of forceful termination by hythread_cancel() + thread_set_self(NULL); fast_thread_array[thread->thread_id] = NULL; @@ -524,6 +526,7 @@ IDATA VMCALL hythread_get_group(hythread_group_t *group, hythread_t thread) { * @return none */ void VMCALL hythread_cancel(hythread_t thread) { + hythread_detach(thread); os_thread_cancel(thread->os_handle); } -- 1.4.1.g4455