1/* Invoke pthread_detach() with an invalid thread ID. */ 2 3#include <assert.h> 4#include <errno.h> 5#include <pthread.h> 6#include <stdio.h> 7 8static void* thread_func(void* arg) 9{ 10 return 0; 11} 12 13int main(int argc, char** argv) 14{ 15 pthread_t thread; 16 17 pthread_create(&thread, NULL, thread_func, NULL); 18 pthread_join(thread, NULL); 19 20 /* Invoke pthread_detach() with the thread ID of a joined thread. */ 21 pthread_detach(thread); 22 23 /* Invoke pthread_detach() with an invalid thread ID. */ 24 pthread_detach(thread + 8); 25 26 fprintf(stderr, "Finished.\n"); 27 28 return 0; 29} 30