Bob Ippolito wrote: > There is no single PerfectReactor. There are several use cases where > you need to wait on >1 different event systems, which guarantees at > least two OS threads (and two event loops). In general it's nice to > have a single Python event loop ("the reactor") to act on said threads > (e.g. something just sitting on a mutex waiting for messages) but > waiting for IO to occur should *probably* happen on one or more > ancillary threads -- one per event system (e.g. select, GTK, > WaitForMultipleEvents, etc.) Why couldn't PerfectReactor be a reactor for other reactors? A sort of concentrator for these multiple event systems and multiple threads.
You ask to listen to sockets, so it instantiates a singleton PerfectReactor which instantiates a select() reactor and listens to it directly in a single-threaded manner. If you then ask to listen to Win32 messages, the PerfectReactor instantiates a GetMessage() reactor. Then, realizing it has two "event systems", it spawns a thread for each child reactor with a listener that serializes the incoming events into the PerfectReactor's queue. Bingo, your application doesn't need to be written thread-safe, PerfectReactor is platform-agnostic, and you don't have to know in advance all the event types you might ever listen to. Sorry if this is a dumb question (or if I'm mangling the terminology), /larry/ _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com