Re: Making Event work for Win32
[email protected] (Graham Barr)
| Newsgroups | perl.loop |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Mar 21, 2000 at 04:37:11PM +0000, Nick Ing-Simmons wrote: > Graham Barr <[email protected]> writes: > >> If I understand the code, pe_sys_multiplex basically waits in a poll/select > >> call until something pops up to wake it up. This implies that there is > >> essentially only one waiting state, which all watchers have to tie into. In > >> other words, if Event is sleeping on a set of filehandles, and some other > >> type of event comes in (an X event handled by a new type of watcher?) the > >> poll/select won't wake up and the event won't be serviced immediately. > > > >But the X event would enter the application on a file descriptor. > > True, one does do a select/poll on the X socket(s). > But you need to layer another "logical" watcher on top of that > as one "message" up the socket may contain multiple X events > (Xlib sucks all the XEvents out of the socket and queues them) > so "socket not readable" does NOT mean "No XEvents pending". > Also IIRC this is TCP socket so an XEvent may not be complete. > You also need to XFlush() pending outgoing requests prior to the select(). Yes, but when the X socket becomes readable you ask Xlib for the events and queue them in Event's queue. This will cause them to be processed before sleeping again. Graham.