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 9:55:45 PM UTC+13, Victor Porton wrote:
>> 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.
> 
> The usual behaviour for POSIX is that the call is aborted with EINTR after
> you get the signal.

That poll() is interrupted does not imply that Python will run its pythonic 
signal handler at the point of interruption. That is a problem.

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