[Twisted-Python] Blocking on deferreds during unit tests (e.g. deferredResult)

Christopher Armstrong radeex at gmail.com
Sat May 7 21:31:34 EDT 2005


On 5/8/05, Jp Calderone <exarkun at divmod.com> wrote:
> On Sat, 7 May 2005 11:02:09 -0400, Kevin Dangoor <dangoor at gmail.com> wrote:
> >I'm only a little familiar with greenlet. Is there any significant
> >disadvantage to using this approach extensively? For example, is the
> >overhead very large?
> 
>   The main advantage is also the main disadvantage: when using gthreadless, 
> rather than function callbacks, it becomes less obvious where context switches 
> occur, leading to an increased likelihood of introducing concurrency-related 
> bugs (primarily due to switches out of non-atomic operations).

If you replace all occurences of "gthreadless" there with "greenlets
in general", then you're correct. However, if one is talking about
gthreadless, this argument is not true.

All context switches still *are* obvious. Every asynchronous operation
is still wrapped in a blockOn(), just like deferred generators.
gthreadless is basically deferred generators with much nicer syntax.


-- 
  Twisted   |  Christopher Armstrong: International Man of Twistery
   Radix    |    -- http://radix.twistedmatrix.com
            |  Release Manager, Twisted Project
  \\\V///   |    -- http://twistedmatrix.com
   |o O|    |  Founding Member, Hobart Hacking Society
w----v----w-+    -- http://hackingsociety.org/chapters/hash




More information about the Twisted-Python mailing list