From 6e01e6ba502d17db4e03fd281e2aa1dd13f7c35e Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Mon, 16 May 2022 10:03:13 +0000 Subject: Use threads instead of procs for the timeout function --- concurrency.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'concurrency.c') 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 */ -- cgit v1.2.3