On Jun 11, 2:08 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Mon, 11 Jun 2007 04:56:43 -0700, geoffbache <[EMAIL PROTECTED]> 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. >
My application is only incidentally a network application. It doesn't have clients and servers as such, it just distributes its work via a grid engine and then lets these workers communicate back their results via sockets. > 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. > Yes, I would avoid signals or threads if I could, but it's tough. The program is supposed to "appear" to just be a batch process, so handling e.g. ctrl-C is essential. The standard SocketServer doesn't allow for this, so I need some other thread of control that will, or some means of "asynchronising" SocketServer internally. Or there's always the really hacky low tech solution which has a certain appeal : have the main thread check all the others for being alive and sleep in between... Geoff -- http://mail.python.org/mailman/listinfo/python-list