diff options
author | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2022-05-16 10:03:13 +0000 |
---|---|---|
committer | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2022-05-16 10:03:13 +0000 |
commit | 6e01e6ba502d17db4e03fd281e2aa1dd13f7c35e (patch) | |
tree | bc7cb15dac62bbc886945a58bc07666b67c40b3f /concurrency.c | |
parent | be46eb0b50d7c5f93ee6590ad99fc823608013c4 (diff) |
Use threads instead of procs for the timeout function
Diffstat (limited to 'concurrency.c')
-rw-r--r-- | concurrency.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/concurrency.c b/concurrency.c index 78ac18b..03b4a68 100644 --- a/concurrency.c +++ b/concurrency.c @@ -25,9 +25,9 @@ static ThreadData **threads; int mainstacksize = STACKSIZE; void -recvtimeout(void *raw) +recvtimeout(void *) { - ThreadData *td = (ThreadData *)raw; + ThreadData *td = getthreaddata(); if(0 == sleep(td->timeout)){ qlock(&td->lock); td->timedout = 1; @@ -114,7 +114,7 @@ messagerecv(Function match, int timeout) if(timeout > 0){ td->timeout = timeout; qunlock(&td->lock); - timeoutid = proccreate(recvtimeout, td, STACKSIZE); + timeoutid = threadcreate(recvtimeout, nil, STACKSIZE); qlock(&td->lock); } td->timedout = 0; /* clear the timeout bit */ |