From e315cafa0167d86620802ab0663247ee4f5f708b Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 7 Oct 2017 16:41:26 +0100 Subject: [PATCH] Fix for GitHub issue #165 : assertion failure on thread join. If a thread becomes detached due to a join_any statement, that thread must not attempt to join its parent, even if the parent is waiting on a subsequent join statement. --- vvp/vthread.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 5ea584cbe..64fc3b6a0 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -2738,7 +2738,7 @@ bool of_END(vthread_t thr, vvp_code_t) /* If I have a parent who is waiting for me, then mark that I have ended, and schedule that parent. Also, finish the %join for the parent. */ - if (thr->parent && thr->parent->i_am_joining) { + if (!thr->i_am_detached && thr->parent && thr->parent->i_am_joining) { vthread_t tmp = thr->parent; assert(! thr->i_am_detached);