Issue
This code can't be executed. Signal is sent to the function via signal, but the code inside the function is not running.
void my_sigtrap(int sig) {
LOGD("mtf---- why not working ");
}
void test_signal() {//SIGTRAP
signal(SIGTRAP, my_sigtrap);
}
why my_sigtrap function not working?
Solution
The function signal()
does not send the signal, but installs your own signal handler so when that signal is received your function will be executed to handle it. The signal is actually sent to the process using the kill()
API (look up the details using man 2 kill
).
Answered By - Larry Schiefer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.