Threads, signals and sockets (on UNIX)

Jean-Paul Calderone exarkun at divmod.com
Mon Jun 11 08:08:55 EDT 2007


On Mon, 11 Jun 2007 04:56:43 -0700, geoffbache <geoff.bache at pobox.com> wrote:
>
>> Twisted *should* be able to do this, as it uses non-blocking IO.
>>
>> http://twistedmatrix.com/trac/
>
>Thanks for the tip. I'll take a look if nobody has any better
>suggestions.

Twisted is a pretty good suggestion in general. ;)

>
>It still seems to me that what I'm trying to do is essentially quite
>simple, and shouldn't require
>as large a tool as Twisted to fix it. Isn't Twisted basically for web
>applications?

Twisted supports HTTP, but it does plenty of other things too.  Generally
speaking, it's useful for any network application, plus some other stuff.

You're half right about this being simple though, and not needing Twisted
to solve the problem.  The only thing you need to do to solve the problem
is avoid using either signals or threads.  Interaction between the two is
very complicated and, as you've noticed, varies across platforms.  Twisted
is solving the problem for you here by letting you do I/O without using
threads, making signals *almost* simple.

Jean-Paul



More information about the Python-list mailing list