From adb643fc8130cd396acf08153f75e2f1cd059bd7 Mon Sep 17 00:00:00 2001 From: glenda Date: Mon, 19 Sep 2022 08:29:59 +0000 Subject: Don't refcount symbol tables --- concurrency.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'concurrency.c') 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); -- cgit v1.2.3