osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Handle SIGINT in C and Python


I need to assign a real C signal handler to SIGINT.

This handler may be called during poll() waiting for data. For this reason I 
cannot use Python signals because "A Python signal handler does not get 
executed inside the low-level (C) signal handler. Instead, the low-level 
signal handler sets a flag which tells the virtual machine to execute the 
corresponding Python signal handler at a later point(for example at the next 
bytecode instruction)."

I want after my signal handler for SIGINT executed to raise 
KeyboardInterrupt (as if I didn't installed my own signal handler).

Is this possible? How?

-- 
Victor Porton - http://portonvictor.org