Trapping signals in Python

According to the documentation :

It is not possible to temporarily “block” signals from critical sections (since this is not supported by all Unix tastes).

What prevents me from using signal.signal(signum,SIG_IGN)to block it and then add a signal?

+3
source share
1 answer

What stops you is that if the signal really comes and SIG_IGN is in place, it will be ignored and thrown away. When you add a signal later, it is too late because it has disappeared and you will never know that it happened.

, "" (= ) , "" (= ). - , , "" : , , , .

. ( , ). . UNIX. 10.8 , , " ", , , , .

: Ubuntu, "man sigprocmask" ( manpages-dev ), , . , Python, Unix, , Irix AIX Python, "sigprocmask". , , .: -)

+11

Source: https://habr.com/ru/post/1721572/


All Articles