diff options
author | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2022-05-09 18:59:23 +0000 |
---|---|---|
committer | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2022-05-09 18:59:23 +0000 |
commit | e425895a315d65ff9ca1e2d7911c2fd21d49fe5e (patch) | |
tree | 7622287d299dbf3edad7679841a59ac47348f1f5 /concurrency.c | |
parent | 0f547edbd76814f7a8299f5e1647cd0816276ba8 (diff) |
Fix some nasty bugs with empty lines in dfns, and with stranding of ⍺ and ⍵.
Diffstat (limited to 'concurrency.c')
-rw-r--r-- | concurrency.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/concurrency.c b/concurrency.c index 81ff7b1..1d06a9c 100644 --- a/concurrency.c +++ b/concurrency.c @@ -49,7 +49,7 @@ spawnthread(Function f, Array *left, Array *right) */ Channel *setupdone = chancreate(sizeof(int), 0); SpawnData *sp = emalloc(sizeof(SpawnData)); - sp->func = f; + sp->func = dupfunction(f); sp->left = left ? duparray(left) : nil; sp->right = duparray(right); sp->setupdone = setupdone; @@ -87,6 +87,8 @@ messagesend(Array *a, int id) td->lastmail = newmail; rwakeup(&td->empty); qunlock(&td->lock); + }else{ + throwerror(L"Invalid thread id", EDomain); } } @@ -134,6 +136,7 @@ newprocfn(void *data) unlock(&threadlock); freearray(sp->left); freearray(sp->right); + freefunction(sp->func); free(sp); free(td); } |