Here is the small C source code using pthread_kill ():
#include <stdlib.h> #include <pthread.h> #include <signal.h> int main(int argc, char *argv[]) { pthread_t th = NULL; pthread_kill(th, 0); return 0; }
Compiling Gcc produces different results depending on the value of the -std argument (see below). I do not understand these different behaviors. I did not get any interesting information in the man pages, except that pthread_kill () is POSIX.1-2008 compatible.
Environment: Linux 3.2 64 bit. GCC 4.7.2.
C -std = c11
gcc main.c -std=c11 -pthread
I get an implicit declaration:
main.c:9:2: warning: implicit declaration of function 'pthread_kill' [-Wimplicit-function-declaration]
C -std = c99
gcc main.c -std=c99 -pthread
Same result as -std = c11:
main.c:9:2: warning: implicit declaration of function 'pthread_kill' [-Wimplicit-function-declaration]
C -std = c90
gcc main.c -std=c90 -pthread
It just works without any errors / warnings.
Thanks for your feedback.
source share