[Twisted-Python] Re: [Twisted-commits] r13295 - WSGI input/error streams, pausing when write buffer is full, and file wrapper.
22 Mar 2005 22 Mar '05
On Tue, Mar 22, 2005 at 03:50:59PM -0700, James Knight wrote: [...]
+def callInReactor(__f, *__a, **__kw):
- from twisted.internet import reactor
- queue = Queue.Queue()
- reactor.callFromThread(__callFromThread, queue, __f, __a, __kw)
- result = queue.get()
- if isinstance(result, failure.Failure):
- return result
+def __callFromThread(queue, f, a, kw):
- result = defer.maybeDeferred(f, *a, **kw)
I recall posting example code to do a similar job to the mailing list recently, and also someone on the list (or irc channel?) asking how to do this (make the thread that does callFromThread block on the result).
This should probably be turned into a proper API.
Age (days ago)
Last active (days ago)