From 34f6e25b4e15b5f0bb7d37a1c021f1b9e0737b75 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Mon, 27 May 2013 20:17:44 +0100 Subject: [PATCH] Revised fix for bug 931. We can't directly determine that a %fork operation is a task or function call, so need to infer this by comparing the parent and child scopes. --- vvp/vthread.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vvp/vthread.cc b/vvp/vthread.cc index c05ab3541..4eb1f7445 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -2715,13 +2715,14 @@ bool of_FORK(vthread_t thr, vvp_code_t cp) child->parent = thr; thr->children.insert(child); - int child_type = cp->scope->get_type_code(); - if ((child_type == vpiTask) || (child_type == vpiFunction)) + /* If the child scope is not the same as the current scope, + infer that this is a task or function call. */ + if (cp->scope != thr->parent_scope) thr->task_func_children.insert(child); /* If the new child was created to evaluate a function, run it immediately, then return to this thread. */ - if (child_type == vpiFunction) { + if (cp->scope->get_type_code() == vpiFunction) { child->is_scheduled = 1; vthread_run(child); running_thread = thr;