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.
This commit is contained in:
Martin Whitaker 2013-05-27 20:17:44 +01:00
parent afe1e79338
commit 34f6e25b4e
1 changed files with 4 additions and 3 deletions

View File

@ -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;