[Twisted-Python] Synchronous Code Fishbowl

Matt Goodall matt at pollenation.net
Mon May 29 18:19:20 MDT 2006


Ed Suominen wrote:
> Glyph wrote:
>> syncbridge looks like an interesting module.  I've often wanted to do
>> something similar, to have a "one right way" for integrating with
>> non-async-clean legacy code which also doesn't necessarily support
>> threaded concurrency either.
[...]
> 
> Well of course, Glyph's "interesting module" comment was just enough of
> a table scrap to get me running, tail wagging furiously. The result
> (unit testing in progress) is a full-fledged SynchronousTasks object
> that runs a priority queue of synchronous tasks with niceness
> scheduling. See
> 
> * http://foss.eepatents.com/sAsync/browser/trunk/sasync/syncbridge.py
> * http://foss.eepatents.com/sAsync/browser/trunk/test/syncbridge.py
> 
> Once fully tested, would SynchronousTasks be considered as an addition
> to twisted.internet.threads?

Just scanned through that module and the idea looks useful to me too.

In fact, AFAICT, it's basically the same technique I used for laxdb, 
<http://twistedmatrix.com/trac/browser/sandbox/mg/laxdb.py>.

One small comment, and it's totally untested ... I don't think an 
already empty SynchronousQueue can be shutdown because nothing will wake 
the processing loop in _workOnTasks.


- Matt


-- 
      __
     /  \__     Matt Goodall, Pollenation Internet Ltd
     \__/  \    w: http://www.pollenation.net
   __/  \__/    e: matt at pollenation.net
  /  \__/  \    t: +44 (0)113 2252500
  \__/  \__/
  /  \	       Any views expressed are my own and do not necessarily
  \__/          reflect the views of my employer.




More information about the Twisted-Python mailing list