[Twisted-Python] design of twisted application

Jason Rennie jrennie at gmail.com
Wed Feb 2 14:36:30 MST 2011


On Wed, Feb 2, 2011 at 2:15 AM, Kurt Spindler <kespindler at gmail.com> wrote:

> I am trying to design a twisted application, (I'm pretty new to twisted and
> networking in general) and I feel like I'm not approaching it quite the
> right way and would appreciate your feedback. First part, is that I am
> trying to couple twisted with an existing graphics-type application, that
> already has it's own main loop, etc. Meaning, I need to be running other
> python code while I have the reactor running. Is the solution threading?
>

I would guess so.  Otherwise, you may have to significantly rework the
graphics lib to fit into twisted.  I was involved in a project where I
joined cherrypy and twisted into a single process.  I ran each in a separate
thread.  Note that you will need to become very familiar with
callFromThread()---any twisted call you want to make from the graphics side
will need to use this in case the reactor is blocking (e.g. stuck in a
select() call).  Also, if the graphics lib either manipulates or relies on
certain signal behavior, you may need to install your own signal handlers
which do all the processing that both the graphics lib and twisted expect.
 This is especially important if you start any processes from twisted
(ProcessProtocol).

Cheers,

Jason

-- 
Jason Rennie
Research Scientist, ITA Software
617-714-2645
http://www.itasoftware.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20110202/156f744c/attachment.html>


More information about the Twisted-Python mailing list