Thread Cancellation in GNU/Linux : Today, I'm interested to explore how we can prepare thread in GNU/Linux to ignore thread cancellation. This is acvhieved with pthread_setcancelstate(). The signature of the function is: int pthread_setcancelstate(int state, int *oldstate); The function is thread and signal safe. The function sets the cancel state to one of PTHREAD_CANCEL_ENABLE or PTHREAD_CANCEL_DISABLE and returns the old cancel state. Please see the second parameter. void *Print_Details(void *param) { printf("This is secondary thread's entry...\n"); int oldState; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState); sleep(1); for(int i = 0; i < 10; ++i) { printf("Inside the secondary thread...\n"); } ...