diff options
author | glenda <glenda@cirno> | 2022-09-18 19:58:41 +0000 |
---|---|---|
committer | glenda <glenda@cirno> | 2022-09-18 19:58:41 +0000 |
commit | e275bf9ff105bbb3e12fcf15e3ab755ed0cd26cf (patch) | |
tree | 8db2ea862204c026c2fe5670a15deaaeadc88960 /concurrency.c | |
parent | 269c81f0217999367b4180e6a795142cbb2d02e7 (diff) |
Chain the symbol tables, not the dfn frames
Diffstat (limited to 'concurrency.c')
-rw-r--r-- | concurrency.c | 10 |
1 files changed, 6 insertions, 4 deletions
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); |