[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] CVS update (1090): scheduler and blocking I/O
From: |
felix |
Subject: |
[Chicken-users] CVS update (1090): scheduler and blocking I/O |
Date: |
Wed, 29 Jan 2003 22:27:06 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529 |
Hello, everybody!
The current CVS version features an improved scheduler that
is able to block threads selectively on I/O. There is no proper
API yet, but some basic experiments seem to work fine.
It is fairly simple: `##sys#thread-block-for-i/o' adds a given
thread to a list of fd/thread pairs. The scheduler checks
on every thread-switch wether any threads are waiting for I/O
and (if there are) calls `select()', and subsequently unblocks
any threads for which the fd's signal input or output.
The implementation should be tuned somewhat, but generally
it works ok.
How to implement non-blocking I/O:
If srfi-18 is used/required, we have the following procedure:
[procedure] (##sys#thread-block-for-i/o THREAD FD FLAG)
Blocks THREAD on file-descriptor FD for input (FLAG is true)
or output (FLAG is false). Note that this doesn't perform a
context switch (call `thread-yield!' for actually switching
to another thread).
Now we can create a custom I/O port (say buffered), that reads/writes
from/to a file and, when no data is available, invokes the
mentioned procedure and waits for more.
Any suggestions, comments, bug-reports welcome.
cheers,
felix
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Chicken-users] CVS update (1090): scheduler and blocking I/O,
felix <=