[Twisted-Python] New user questions

Christopher Armstrong radeex at gmail.com
Sun Feb 6 17:35:58 MST 2005


On Mon, 07 Feb 2005 10:08:03 -0600, Eric Mangold
<teratorn at twistedmatrix.com> wrote:
> On Sun, 6 Feb 2005 13:30:55 -0800, snacktime <snacktime at gmail.com> wrote:
> > So I guess the main problem that arises is when calling some code that
> > blocks, but there is no twisted component that you can use to make the
> > code non blocking.  In which case you have to resort to using threads
> > or processes correct?
> 
> Correct. http://twistedmatrix.com/documents/current/howto/threading
> 
> (or it should be possible to use Stackless Python with radix's
> Deferred support code, in the sandbox; it's experimental of course)

Not quite; stackless, greenlets, and so forth won't prevent you from
blocking on blocking code (by which I mean code that blocks on system
calls or synchronous CPU computations); they're essentially a way to
make asynchronous stuff look synchronous. They may make it easier to
rewrite such code to be asynchronous, but you'd still need to modify
the code.

(Let's ignore Pavel's evil "LettuceWrapper" hack).

-- 
  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