Issue
Please see following Python code:
def Handler(signum, frame):
#do something
signal.signal(signal.SIGCHLD, Handler)
Is there a way to get process ID from which signal came from? Or is there another way to get process ID from which signal came from without blocking main flow of application?
Solution
You cannot directly. The signal module of Python standard library has no provision for giving access to the Posix sigaction_t
structure. If you really need that, you will have to build a Python extension in C or C++.
You will find pointers for that in Extending and Embedding the Python Interpreter - this document should also be available in your Python distribution
Answered By - Serge Ballesta Answer Checked By - Robin (WPSolving Admin)