[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] How to avoid busy waiting when using tcp-accept and
Re: [Chicken-users] How to avoid busy waiting when using tcp-accept and threads?
Mon, 24 Feb 2003 23:45:17 +0100
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529
Sven Hartrumpf wrote:
I have a server program that serves client requests in parallel using
chicken threads. The main structure of the server is given below.
Currently, even before the first request comes in, the server needs 100%
cpu time. The server is the only thread at that time and stays in the
first part of the loop because tcp-accept-ready? returns #f. This is
as intended, but how can I avoid this busy waiting?
Currently not. tcp-accept is non-blocking exactly because we want
other threads to run.
But perhaps we can add a little hack: if no other threads are running
*or* blocked for timeout/input, we can do a blocking accept().
Would this work?