|
From: | felix |
Subject: | Re: [Chicken-users] How to avoid busy waiting when using tcp-accept and threads? |
Date: | Tue, 25 Feb 2003 19:59:04 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529 |
felix wrote:
Joerg F. Wittenberger wrote:To me it looks as if there is a glitch in the scheduler code. While you code sits busy wainting, the scheduler would do the same, if there where only blocked threads.Yes, but the scheduler will *loop* waiting for threads to become available (for example, because of timeout).
Wait, Felix. Not so fast. [Some loud thinking follows...] Of course the scheduler should wait indefinitely, if threads are blocked for I/O, but none are for timeout, right? (just to rehash: threads are blocked for the following reasons: 1) timeout (thread-join!/thread-sleep!) 2) I/O (tcp-accept, I/O on socket ports) 3) Mutexes (these are explicitly unblocked after mutex operations - so the scheduler doesn't knwo about these) 4) Thread-termination (thread-join!) as 3), basically. (thread-termination unblocks those). So, if no thread is blocked for timeout, and some are for I/O, other threads can by no means be unblocked because of other reasons.) Is this correct? cheers, felix
[Prev in Thread] | Current Thread | [Next in Thread] |