...
This code uses the pthread_kill()
function to send a SIGKILL
SIGTERM
signal to the created thread. The thread receives the signal, and the entire process is terminated.
Code Block | ||||
---|---|---|---|---|
| ||||
void func(void *foo) { /* Execution of thread */ } int main(void) { int result; pthread_t thread; if ((result = pthread_create(&thread, NULL, func, 0)) != 0) { /* Handle Error */ } if ((result = pthread_kill(thread, SIGKILLSIGTERM)) != 0) { /* Handle Error */ } /* ContinueThis executingpoint untilis thenot signalreached killsbecause the process terminates in pthread_kill() */ return 0; } |
Compliant Solution
...