Automatic scope are OK in detached threads

...assuming certain conditions that should by definition be
true. So this patch amounts to improving an assert condition.
This commit is contained in:
Stephen Williams 2013-09-09 19:47:22 -07:00
parent 07cc18284c
commit 8412d0d55f
1 changed files with 5 additions and 2 deletions

View File

@ -3110,8 +3110,11 @@ bool of_JOIN_DETACH(vthread_t thr, vvp_code_t cp)
vthread_t child = *thr->children.begin();
assert(child->parent == thr);
// We cannot detach automatic tasks/functions
assert(child->wt_context == 0);
// We cannot detach automatic tasks/functions within an
// automatic scope. If we try to do that, we might make
// a mess of the allocation of the context. Note that it
// is OK if the child context is distinct (See %exec_ufunc.)
assert(child->wt_context==0 || thr->wt_context!=child->wt_context);
if (child->i_have_ended) {
// If the child has already ended, then reap it.
vthread_reap(child);