Re: [Orbit-python-list] Catching SIGINT inside orb.run()
Status: Inactive
Brought to you by:
tack
From: Christian R. R. <ki...@as...> - 2000-11-30 14:42:42
|
On Wed, 29 Nov 2000, Jason Tackaberry wrote: > When the ORB's run method is called, it in turn calls CORBA_ORB_run > which starts the main loop. So, control is not returned to the Python > interpreter until a CORBA event happens. This means by using the signal > module, if the program receives a signal for which a custom handler is > installed, the handler will not be called until some event happens (a > client invokes a method from the server, or the ORB exits, for example). Yes, it does seem to be the case. Interesting that if you set a handler for a signal which CORBA (or python, I can't say) has a default handler, it never get called, whereas if you signal a default handler it does work. E.g, for the fragment: orb=CORBA.ORB_init(sys.argv,CORBA.ORB_ID) orb.run() I get: blackjesus:~/devel/pyorb> kill -ALRM %2 [2] Alarm clock ./run But for the fragment: def handle_alarm(): print "Foo!" exit signal.signal(signal.SIGALRM, handle_alarm) orb=CORBA.ORB_init(sys.argv,CORBA.ORB_ID) orb.run() I get nothing at all: blackjesus:~/devel/pyorb> kill -ALRM %2 blackjesus:~/devel/pyorb> The process keeps on running. So some handlers are actually called - just user-defined ones aren't. I don't know if this is because we're using CORBA's default handlers. > One possible fix would be to install a custom handler for all signals > just before entering CORBA_ORB_run that somehow allows the interpreter > to take control in order to call the handler set using the signal What call do I have to produce to get the interpreter to handle signal requests? I've managed to implement a dummy handler here that does what I want, but how to I let python handle the events? Take care, -- /\/\ Christian Reis, Senior Engineer, Async Open Source, Brazil ~\/~ http://async.com.br/~kiko/ | [+55 16] 274 4311 |