[Twisted-Python] Re: Can a deferred catch a segmentation fault?

Gerald John M. Manipon Geraldjohn.M.Manipon at jpl.nasa.gov
Thu Sep 20 13:30:09 MDT 2007


Thanks for the responses.

Ed, AsynQueue is exactly what I'm looking for!  Is it possible
for me to test it out?

Gerald

Gerald John M. Manipon wrote:
> Hi,
> 
> I'm using deferToThread to run some python code which may or may not
> be safe.  In particular, the code may load some modules that could
> seg fault.  In this case, deferToThread won't work and the python
> process will bomb so I was wondering what Defer strategy I could
> use to handle this situation:
> 
> from twisted.internet import threads, reactor
> 
> def segFaultFunc():
>     import binning #this will seg fault
>     return True
> 
> def myCb(res):
>     print "Got", res
>     reactor.stop()
> 
> d = threads.deferToThread(segFaultFunc)
> d.addCallback(myCb)
> 
> reactor.run()
> 
> Any help on this is greatly appreciated.
> 
> Thanks,
> 
> Gerald
> 
> 




More information about the Twisted-Python mailing list