diff --git a/vm/thread/src/thread_native_basic.c b/vm/thread/src/thread_native_basic.c index 3019d2b..56cf5d0 100644 --- a/vm/thread/src/thread_native_basic.c +++ b/vm/thread/src/thread_native_basic.c @@ -299,7 +299,10 @@ void VMCALL hythread_yield() { * @return none */ void VMCALL hythread_yield_other(hythread_t thread) { - os_thread_yield_other(thread->os_handle); + assert(thread); + if (hythread_is_alive(thread)) { + os_thread_yield_other(thread->os_handle); + } } /** diff --git a/vm/thread/src/thread_native_thin_monitor.c b/vm/thread/src/thread_native_thin_monitor.c index cb05a71..6da127f 100644 --- a/vm/thread/src/thread_native_thin_monitor.c +++ b/vm/thread/src/thread_native_thin_monitor.c @@ -239,7 +239,7 @@ IDATA VMCALL hythread_unreserve_lock(hythread_thin_monitor_t *lockword_ptr) { // resume owner if (owner) { - os_thread_yield_other(owner->os_handle); + hythread_yield_other(owner); hythread_resume(owner); }