diff options
author | glenda <glenda@cirno> | 2022-09-12 15:49:01 +0000 |
---|---|---|
committer | glenda <glenda@cirno> | 2022-09-12 15:49:01 +0000 |
commit | 92597a2d660285cf32eb0b88ec3d00b4fd48156e (patch) | |
tree | c95b52e5a1029e9cdbd341ef00cc9cdd65441b35 | |
parent | 18c383ac2da9b56a84374645eac3868de0c9331e (diff) |
⎕TASKS 4 now returns number of messages in mailbox
-rw-r--r-- | concurrency.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/concurrency.c b/concurrency.c index c01426d..f35f329 100644 --- a/concurrency.c +++ b/concurrency.c @@ -260,6 +260,7 @@ taskproperty(vlong t, vlong p) { ThreadData *td = nil; Array *res = nil; + int mailcount = 0; lock(&threadlock); for(int i = 0; i < nthreads && td == nil; i++) if(threads[i]->id == t) @@ -280,6 +281,13 @@ taskproperty(vlong t, vlong p) case 3: /* used stacksize */ res = mkscalarint(stackused()); break; + case 4: /* messages in mailbox */ + qlock(&td->lock); + for(Mail *tmp = td->mail; tmp != nil; tmp = tmp->next) + mailcount++; + qunlock(&td->lock); + res = mkscalarint(mailcount); + break; default: unlock(&threadlock); throwerror(L"Invalid task property", EDomain); |