1 /* Test program that triggers mutex reinitialization. */
12 int main(int argc
, char** argv
)
15 pthread_mutexattr_t attr
;
17 pthread_mutexattr_init(&attr
);
18 pthread_mutexattr_settype(&attr
, PTHREAD_MUTEX_NORMAL
);
19 pthread_mutex_init(&m
, &attr
);
20 pthread_mutexattr_destroy(&attr
);
21 pthread_mutex_lock(&m
);
22 pthread_mutex_unlock(&m
);
24 pthread_mutexattr_init(&attr
);
25 pthread_mutexattr_settype(&attr
, PTHREAD_MUTEX_RECURSIVE
);
26 pthread_mutex_init(&m
, &attr
);
27 pthread_mutexattr_destroy(&attr
);
28 pthread_mutex_lock(&m
);
29 pthread_mutex_unlock(&m
);
31 pthread_mutex_destroy(&m
);
33 fprintf(stderr
, "Done.\n");