supporting asyncronous messages

Martin von Loewis loewis at
Wed Mar 7 10:48:32 CET 2001

Joshua Spoerri <josh at> writes:

> for example:
> 	a = wfmessage()
> 	b = wfmessage()
> 	a.send()
> 	b.send()
> 	if a.getResponse() || b.getResponse():
> 	whatever
> If b.getResponse() is already available and true,
> but a.getReponse() is blocking, the program shouldn't
> wait for it. (Yes, this does funny things to
> shortcircuiting order.)
> Is there a sane way to support this behaviour without
> hacking up the compiler? Is it bad news for other
> reasons?

Sure. The "design pattern" being used is the same as in select

ready = reactor.pick_one([a,b], timeout)

Then you have delegated the blocking business into pick_one, where you
have a number of options: busy-waiting, multi-threading, the operating
system's select/WaitForMultipleObjects mechanism, and perhaps others -
it much depends on how getResponse does its blocking.


More information about the Python-list mailing list