[Twisted-Python] twisted threads: synchronous function calls
Ed Suominen
general at eepatents.com
Tue Jun 20 14:08:13 MDT 2006
> From: Andrew Bennetts <andrew-twisted at puzzling.org> On Tue, Jun 20,
> 2006 at 03:52:28PM +0200, Markus Schiltknecht wrote: [...]
>> Now, I might have missed something, but that's sure functionality
>> which Twisted should provide.
>
> See http://twistedmatrix.com/trac/ticket/1042
>
> It has code for a function that does the same basic thing that yours
> does, but with a bit more polish, e.g. if the result is a Deferred,
> it won't wake the calling thread until the Deferred has a result, and
> it handles exceptions.
>
> It just needs someone to write some tests and docs, and then it can
> be merged. The function in that issue has actually been used by a few
> people, so it seems to do the job.
I liked Andrew's idea and incorporated the code of his ticket into my
syncbridge module, which I'm using as part of my sAsync package,
http://foss.eepatents.com/sAsync/
In addition to the topic here, the syncbridge module expands
considerably on the theme of queuing up synchronous tasks. It took a
*lot* of work to get the synchronous/asynchronous interface debugged and
free (apparently) of race conditions. And it has a pretty complete suite
of unit tests, although there's just one test for this particular method
right now.
The sAsync package is GPL, but I just re-licensed the syncbridge module
itself to MIT in hopes of getting Glyph to accept it into Twisted. See
ticket http://twistedmatrix.com/trac/ticket/1768.
Best regards, Ed
More information about the Twisted-Python
mailing list