From e275bf9ff105bbb3e12fcf15e3ab755ed0cd26cf Mon Sep 17 00:00:00 2001 From: glenda Date: Sun, 18 Sep 2022 19:58:41 +0000 Subject: Chain the symbol tables, not the dfn frames --- concurrency.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'concurrency.c') diff --git a/concurrency.c b/concurrency.c index f4709e9..08dfdbc 100644 --- a/concurrency.c +++ b/concurrency.c @@ -66,14 +66,18 @@ spawnthread(Function f, Array *name, Array *left, Array *right) unlock datastructures exit proc */ + + SpawnData *sp = emallocz(sizeof(SpawnData), 1); sp->func = dupfunction(f); - sp->func.scope = dupscope(f.scope); + Symtab *scope = dupscope(f.scope); + freesymtab(sp->func.scope); + sp->func.scope = scope; sp->name = duparray(name); sp->left = left ? duparray(left) : nil; sp->right = duparray(right); sp->done.l = &sp->lock; - + qlock(&sp->lock); int id = rfork(RFPROC|RFMEM); if(id == 0){ /* in new process*/ @@ -221,8 +225,6 @@ newprocfn(SpawnData *sp) freearray(sp->left); freearray(sp->right); freefunction(sp->func); - if(sp->func.scope) - freedfnframe(sp->func.scope, 0); free(sp); free(td); exits(nil); -- cgit v1.2.3