chicken-users
[Top][All Lists]
Advanced

[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


From: felix
Subject: Re: [Chicken-users] How to avoid busy waiting when using tcp-accept and threads?
Date: Mon, 24 Feb 2003 23:45:17 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529

Sven Hartrumpf wrote:
Hi.

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?


cheers,
felix





reply via email to

[Prev in Thread] Current Thread [Next in Thread]