summaryrefslogtreecommitdiff
path: root/concurrency.c
diff options
context:
space:
mode:
Diffstat (limited to 'concurrency.c')
-rw-r--r--concurrency.c10
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);