Consider the following program:
#define _POSIX_C_SOURCE 200809L
#include <time.h>
#include <pthread.h>
#include <signal.h>
void timerfunc(union sigval val) { }
int main()
{
struct sigevent sev = { .sigev_notify = SIGEV_THREAD,
.sigev_notify_function = timerfunc };
timer_t t;
timer_create(CLOCK_REALTIME, &sev, &t);
timer_delete(t);
pthread_exit(0);
}
Linked with glibc, it not only fails to terminate, but it is unkillable except by kill -9
/SIGKILL
. Is this behavior permitted by the standard? Are there good workarounds aside from either always explicitly exiting the process (as opposed to just exiting all threads)?