|
From: skaller <sk...@us...> - 2007-01-20 14:20:46
|
I proprose to remodel the async system as follows.
1. Felix code creates a request object, and executes an svc_general
to issue the request (same as now).
There are roughly 3 kinds of requests:
* synchronous: Felix code execution is suspended until
the request is satisfied.
* blocking: the fibre issuing the request is suspended
until the request is satisfied, but other fibres
continue to run
* asynchronous: the request is queued and an object
returned which can later be waited on, the fibre
continues for a while, then waits. This is fun,
since we might have a 'select' style wait on multiple
asynchronous operations.
2. For blocking requests now. The driver loop
creates an object with a 'completed()' method.
When the request is satisfied, the demuxer or whatever
calls this method on the object.
The object wraps the request details as well.
The driver stores a pointer to its 'ready' queue in the
completion object.
Note that unlike flx_drv, there is one of these things
for every request.
3. The request is then passed to an async server object.
The server object may be unique or shared between
multiple Felix event loops, or, an event loop might
even have two of them (for unknown reason :)
4. The request server may queue the request to some other server,
or it might just call the server directly. The request server
has to dispatch dependent on the kind of request.
5. The usual demux/faio stuff happens. However instead of
using this interface:
virtual bool start_async_op(
demux::demuxer& demux,
flx_drv* drv,
void* f
);
we use this interface:
virtual bool start_async_op(
demux::demuxer& demux,
waker *wakeup
);
and call
wakeup->completed()
to complete the operation, instead of
drv->sched(f)
How does that all sound?
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
|