#include #include #include int stop; void *thr(void *x) { pthread_detach(pthread_self()); printf("thread %p START\n", x); while (!stop) ; printf("thread %p END\n", x); return NULL; } int main(int argc, char *args[]) { int x, i; pthread_t pt; x = sysconf(_SC_NPROCESSORS_ONLN) + 1; stop = 0; for(i=0; i