On 01:54 am, screwt...@froup.com wrote: Just a couple quick (minor) factual corrections. I'll snip everything that does not appear to need correction (of which there was a lot) to make it easier to read. > - Futures support cancellation; Twisted finally managed to get rid > of cancellation support in Deferreds.
We only got rid of Deferred.setTimeout. In exchange, we added generalized cancellation support. >It should be pretty simple to create a Deferred that wraps a Future: > > from twisted.internet import defer > > def deferredFromFuture(future): > d = defer.Deferred() > def callback(future): > e = future.exception() > if e: Futures may call their callbacks in any thread. So the line: > d.fail(e) must instead be something like: reactor.callFromThread(d.errback, e) (notice also `d.callback`, not `d.fail`). A similar change is necessary for the success case below. > return > > d.succeed(future.result()) > > future.add_done_callback(callback) > return d Jean-Paul _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python