I would like to know if a pthread_t
has ever been used. Is there a way to check and see if it is valid before I call pthread_join
?
This example code segfaults:
#include <pthread.h>
static pthread_t pth_freq_loop;
main()
{
pthread_join(pth_freq_loop, NULL);
}
And it can be run as follows:
# gcc -lpthread -o pthread pthread.c
# ./pthread
Segmentation fault