In the following program I created a
using namespace std;
void* func(void *data)
int main( )
pthread_create(&thread1, 0 , &func, (void*)2);
the threads operate mostly independent, meaning that each thread can use a signal-handler to catch a "crash"-signal without having the other threads to be killed aswell. Therefor signal-handlers needs to be added.
source: signal-manpage http://man7.org/linux/man-pages/man7/signal.7.html
A signal may be generated (and thus pending) for a process as a whole (e.g., when sent using kill(2)) or for a specific thread (e.g., certain signals, such as SIGSEGV and SIGFPE, generated as a consequence of executing a specific machine-language instruction are thread directed, as are signals targeted at a specific thread using pthread_kill(3)). A process-directed signal may be delivered to any one of the threads that does not currently have the signal blocked. If more than one of the threads has the signal unblocked, then the kernel chooses an arbitrary thread to which to deliver the signal.