[En-Nut-Discussion] Let's start another discussion: Wait on multiple events
Nathan Moore
nategoose at gmail.com
Tue Feb 26 22:19:39 CET 2008
Since long time I'm thinking about writing da select or poll function
> for NutOS.
May I suggest trying to make them able to wait not just on file IO but also
on events. Of course telling which of the several things has happened.
I think that files becoming ready is done with events so you really
would always be waiting on event type things.
>
>
>
> The linux implementation seem to use several wait queues. One for every
> device driver. A device driver now signals this queue and therefor wakes
> up the calling application. The point where I'm los now: The select
> system call needs to wait on multiple waitqueues at the same time?
>
> Does anyone know more about the internal implementation of select and
> poll? Is there a possibility to "emulate" select with the existing NutOs
> event queues?
If you were to wait on the ready events for all of the files that you wanted
to
poll in their own separate threads and then each thread could post an event
whenever the thing that they were polling became ready and set a bit in a
flag
to tell which of the things is ready. Big, ugly, and not the way it should
be done,
most likely.
One problem with using a ready event as a poll (as both the heart of poll
and of select)
would be that events aren't triggered after they've been waited on and
gotten, but
poll or select would have to see the files as ready for calls after the
initial one even if
no IO were done on the file.
>
>
> Any suggestions or literature on this subject?
Only that the exact semantics of poll and select do differ slightly from one
system that implements them
to another.
Nathan
More information about the En-Nut-Discussion
mailing list