Home | History | Annotate | Download | only in pthread_cond_timedwait

Lines Matching defs:mutex

15  *   Upon successful return, the mutex shall have been locked and shall
33 pthread_mutex_t mutex;
48 if (pthread_mutex_lock(&td.mutex) != 0) {
49 fprintf(stderr, "Thread1 failed to acquire the mutex\n");
63 rc = pthread_cond_timedwait(&td.cond, &td.mutex, &timeout);
82 if (pthread_mutex_trylock(&td.mutex) == 0) {
84 "Thread1 should not be able to lock the mutex again\n");
88 fprintf(stderr, "Thread1 failed to trylock the mutex (as expected)\n");
90 if (pthread_mutex_unlock(&td.mutex) != 0) {
91 fprintf(stderr, "Thread1 failed to release the mutex\n");
95 fprintf(stderr, "Thread1 released the mutex\n");
103 if (pthread_mutex_init(&td.mutex, NULL) != 0) {
104 fprintf(stderr, "Fail to initialize mutex\n");
119 /* acquire the mutex released by pthread_cond_wait() within thread 1 */
120 if (pthread_mutex_lock(&td.mutex) != 0) {
121 fprintf(stderr, "Main failed to acquire mutex\n");
124 if (pthread_mutex_unlock(&td.mutex) != 0) {
125 fprintf(stderr, "Main failed to release mutex\n");