blob: c02eef11abf3178455cda4cc4ea2f2075eab016b [file] [log] [blame]
bart3f5cc7e2011-03-09 17:50:34 +00001/* 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. */
petarjc9fa6402012-12-20 19:02:17 +000024 pthread_detach(thread + 8);
bart3f5cc7e2011-03-09 17:50:34 +000025
26 fprintf(stderr, "Finished.\n");
27
28 return 0;
29}