Hello,
I have to send SIGSEGV to the thread.
What is the simplest and efficient way to do that?
anyone on this?
Why do you want to send a SIGSEGV? That it usually sent by a program to indicate that it encountered a segment violation, aka segfault. If you want to tell the thread to end, use one of USR1, USR2, TERM, or HUP. How to do that: see man kill.
Also, please do not bump up threads (see The UNIX and Linux Forums - Forum Rules)
Did you mean a process or a thread?
If you want to end a thread you can call pthread_cancel, but if a thread is canceled in the middle of the code, resources are not deallocated and could be leaked.
Regards
Hello All,
I want to reproduce a Crash scenario where SIGSEGV was encountered to a thread. I have setup all necessary envr and now I just need to know how I can send "SIGSEGV" to the "thread"
You can simulate a SIGSEGV with this code in your thread:
char *s = "String";
*s = 'S';
Regards