osdir.com


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

Handle SIGINT in C and Python (Posting On Python-List Prohibited)


Lawrence D?Oliveiro wrote:

> On Wednesday, January 31, 2018 at 8:58:18 PM UTC+13, Victor Porton wrote:
>> 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)."
> 
> Why is that a problem?

As I already said, I need to handle the signal (SIGCHLD) while poll() waits 
for i/o.

You can read the sources (and the file HACKING) of the C library which I am 
wrapping into Python here:

https://github.com/vporton/libcomcom

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