Hi!
You protect the variable "int died" only in the "killer" thread against mutual
access. In the worker
thread it isn't protected!
The code
while (!died) {
should be rewritten to
while (1) {
pthread_mutex_lock(&mutex);
if (died) {
pthread_mutex_unlock(&mutex);
break;
}
pthread_mutex_unlock(&mutex);
Harald