Home | History | Annotate | Download | only in pthread_cond_broadcast

Lines Matching defs:mutex

11  *   own the mutex with which it called pthread_cond_wait().
25 pthread_mutex_t mutex;
37 if (pthread_mutex_lock(&td.mutex) != 0) {
38 fprintf(stderr, "[Thread 0x%p] failed to acquire the mutex\n",
42 fprintf(stderr, "[Thread 0x%p] started and locked the mutex\n",
48 rc = pthread_cond_wait(&td.cond, &td.mutex);
54 if (pthread_mutex_trylock(&td.mutex) == 0) {
56 "mutex again\n", (void *)self);
61 "mutex again\n", (void *)self);
64 if (pthread_mutex_unlock(&td.mutex) != 0) {
66 "mutex\n", (void *)self);
70 fprintf(stderr, "[Thread 0x%p] released the mutex\n", (void *)self);
79 if (pthread_mutex_init(&td.mutex, NULL) != 0) {
80 fprintf(stderr, "Fail to initialize mutex\n");
97 /* Acquire the mutex to make sure that all waiters are currently
99 if (pthread_mutex_lock(&td.mutex) != 0) {
100 fprintf(stderr, "Main: Fail to acquire mutex\n");
103 if (pthread_mutex_unlock(&td.mutex) != 0) {
104 fprintf(stderr, "Main: Fail to release mutex\n");