diff options
author | glenda <glenda@cirno> | 2022-09-19 08:29:59 +0000 |
---|---|---|
committer | glenda <glenda@cirno> | 2022-09-19 08:29:59 +0000 |
commit | adb643fc8130cd396acf08153f75e2f1cd059bd7 (patch) | |
tree | 6786dd37eebde957b4e6fe036afc57efac31c97b /concurrency.c | |
parent | e275bf9ff105bbb3e12fcf15e3ab755ed0cd26cf (diff) |
Don't refcount symbol tables
Diffstat (limited to 'concurrency.c')
-rw-r--r-- | concurrency.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/concurrency.c b/concurrency.c index 08dfdbc..b45ee08 100644 --- a/concurrency.c +++ b/concurrency.c @@ -70,9 +70,7 @@ spawnthread(Function f, Array *name, Array *left, Array *right) SpawnData *sp = emallocz(sizeof(SpawnData), 1); sp->func = dupfunction(f); - Symtab *scope = dupscope(f.scope); - freesymtab(sp->func.scope); - sp->func.scope = scope; + sp->func.scope = dupscope(f.scope); sp->name = duparray(name); sp->left = left ? duparray(left) : nil; sp->right = duparray(right); @@ -224,6 +222,7 @@ newprocfn(SpawnData *sp) freearray(sp->name); freearray(sp->left); freearray(sp->right); + freesymtab(sp->func.scope); freefunction(sp->func); free(sp); free(td); @@ -271,6 +270,7 @@ threadproperty(vlong t, vlong p) ThreadData *td = nil; Array *res = nil; int mailcount = 0; + int framecount = 0; lock(&threadlock); for(int i = 0; i < nthreads && td == nil; i++) if(threads[i]->id == t) @@ -292,9 +292,16 @@ threadproperty(vlong t, vlong p) qunlock(&td->lock); res = mkscalarint(mailcount); break; - case 3: /* used stacksize */ + case 3: /* used C stacksize */ res = mkscalarint(td->stackused); break; + case 4: /* DfnFrame count */ + qlock(&td->lock); + for(DfnFrame *f = td->currentdfn; f != nil; f = f->prev) + framecount++; + qunlock(&td->lock); + res = mkscalarint(framecount); + break; default: unlock(&threadlock); throwerror(L"Invalid thread property", EDomain); |