osdir.com


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

[Python-Dev] Removing PID check from signal handler


On 12.04.2019 21:05, Steve Dower wrote:
> On 12Apr.2019 0919, Jeroen Demeyer wrote:
>> The signal handler (that receives signals from the OS) in Python starts
>> with a check
>>
>>  ??? if (getpid() == main_pid)
>>
>> Looking at the comments, the intent was to do a check for the main
>> *thread* but this is checking the *process* id. So this condition is
>> basically always true. Therefore, I suggest to remove it in
>> https://bugs.python.org/issue36601
>>
>> If you have any objections or comments, I suggest to post them to that bpo.
> To add a little more context, the check was added about 25 years ago as
> a "hack" for some reason that we can't figure out anymore.
>
> So if you are a historian of ancient operating systems and know of one
> that might have raised signal handlers in a different process from the
> one where it was registered, we'd love to hear from you.

According to 
https://www.linuxquestions.org/questions/programming-9/the-return-value-of-getpid-called-from-main-thread-and-new-thread-r-identical-624399/ ,
threads used to have different PIDs in the 2.4 Linux kernel.

> Cheers,
> Steve
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/vano%40mail.mipt.ru

-- 
Regards,
Ivan