10 Feb
2005
10 Feb
'05
11:16 p.m.
snacktime wrote:
In the documentation on Deferred's in the howto section, the examples that show a blocking operation and then a non blocking operation do not show what happened to the blocking code, it just conveniently disappears. For someone new to async programming it might help to
The preferred approach is not to move the blocking call into a thread, but to actually replace it with a non-blocking call. E.g. instead of calling a getStuffFromNetwork() that blocks, call asyncStuffGetter() that sends a request, returns a Deferred, and when the reactor tells asyncStuffGetter() that it got a reply, it calls deferred.callback() with the data.