Am Mittwoch, 6. September 2006 16:38 schrieb Leopold Toetsch: > 2) The event system > > It's not toatally ready to use it for waiting on file descriptors, but most > is already there. > > A minimal interface could be: > > event_add_IO_event(Interp, PMC* pio, PMC *sub, PMC *user_data, int which) > event_del_IO_event(Interp, PMC* pio, int which) > > where which is _READ, _WRITE, or _ERR > > If select returns with one of these pio fds, it would schedule an > interpreter IO event, which eventually runs the the user handler subroutine > with: > > .sub io_handler # the sub above > .param pmc pio # it got ready > .param pmc user_data > > Solution 2) would be fully asynchronous.
I've now (r14465) implemented almost all of the asynchronous select code and it works nicely. There's an example too: examples/io/async_select.pir. If folks think that we should keep this functionality [1], I'll cleanup a bit (add function prototypes and symbolic constants) and complete the code. [1] Instead of blocking on a select/poll system call, Parrot can do more valuable stuff like garbage collection or running some GUI code. Comments welcome, leo