Re: select()/poll() on Win32: possible funding, but is it insane?
[email protected] (Nick Ing-Simmons)
| Newsgroups | perl.perl5.porters,perl.loop |
|---|---|
| Organization | via, but not speaking for : Texas Instruments Ltd. |
| Message-ID | <[email protected]> |
Barries <[email protected]> writes: >On Mon, Jan 29, 2001 at 10:46:07PM +0000, Nick Ing-Simmons wrote: >> Barries <[email protected]> writes: >> > Nick >> >Ing-Simmons mentioned that there might be some possibility of and >> >interest in porting the new poll() implementation to Win32, IIRC. >> >> So I _strongly_ recommend the PerlIO route - but please copy me >> whatever way you go. > >We were only considering the PerlIO route (s/new/PerlIO/ above, sorry >for the vagueness), and looking for guidance/collaboration on it vs. >doing a workaround in Perl inside IPC::Run. I suspect I need to >channel a bit o' the great dane too and be more exact. > >Where do you recommend starting (once we've reviewed the PerlIO source)? Then review the win32/*.c files If you have someone that _really_ knows Win32 IO then they can start in on writing bottom most layer(s) for Win32. That is replace the ":unix" layer that does open/read/write/lseek/close with one that does CreateFile() etc. possibly having ->Open() method choose a table based on the "type" of thing opened (though that may come later). I will get to it eventually but with a Win32 API book open next to me as I write it. The snag then is to figure out whether we can rid perl of its numeric file descriptor fixation (I doubt it), or how best to mimic that. My guess at present is to use the "index" into PerlIO's "array" of PerlIOl* as the "number". The snag with that is when multiple PerlIO * are open to one "number". So we may need an auxillary table indexed by number that points to a PerlIO * (or possibly directly to a sub-layer). As such what we may be doing is "implementing" open/read/write/lseek/close. (But only for binary IO, and we have stdio-oid buffering layer already.) Then we need to make Win32's "select" do the right thing. The "right thing" is probably to build an array of Handles from by mapping select's bitvector-by-descriptor and then call WaitForMultipleEvents(). Then do reverse for select's output args. Then the only tricky bit is getting a wait-able Handle for each type of IO object. In some cases it may be necessary to have a helper thread doing blocking IO on the thing and "signaling" when it gets something. -- Nick Ing-Simmons <[email protected]> Via, but not speaking for: Texas Instruments Ltd.