[Python-Dev] Towards native fileevents in Python (Was Re: Python multiplexing is too hard)

Mark Hammond mhammond@skippinet.com.au
Tue, 23 May 2000 18:24:39 +1000


> Yes but why emphasize the differences when you can instead wipe them out
> by using MsgWaitForMultiple which integrates all sources ? Even if
> there's
> no message stream, it's fine !

Agreed - as I said, it is with these apps that I think it has the most
chance of success.


> Can you be more precise ? Which one(s) do(es)/n't fulfill the two
> conditions mentioned earlier ? I do agree with the fact that the primary
> msg loop of a random GUI package is a black box, however it must use one
> of the IPC mechanisms provided by the OS. Unifying them is not uniformly
> trivial (that's the point of this discussion), but since even on Windows
> it is doable (MsgWait*), I fail to see by what magic a GUI package could
> bypass its supervision.

The only way I could see this working would be to use real, actual Windows
messages on Windows.  Python would need to nominate a special message that
it knows will not conflict with any GUI environments Python may need to run
in.

Each GUI package maintainer would then need to add some special logic in
their message hooking code.  When their black-box message loop delivers
this special message, the framework would need to enter the Python
"event-loop", where it does its stuff - until a new message arrives. It
would need to return, unwind back to the original message pump where it
will be processed as normal, and the entire process repeats.  The process
of waking other objects neednt be GUI toolkit dependent - as you said, it
only need place the well known message in the threads message loop using
PostThreadMessage()

Unless Im missing something?

Mark.