It appears the Python signal module doesn’t have anything similar to the sighold and sigrelse functions found in C, using signal.h. Are there Python equivalents of any sort?
Many thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are no direct bindings for this in Python. Accessing them through ctypes is easy enough; here is an example.
I’m not familiar with the use of these calls, but be aware that Python’s signal handlers work differently than C. When Python code is attached to a signal callback, the signal is caught on the C side of the interpreter and queued. The interpreter is occasionally interrupted for internal housekeeping (and thread switching, etc). It is during that interrupt the Python handler for the signal will be called.
All that to say, just be aware that Python’s signal handling is a little less asynchronous than normal C signal handlers.