Home | History | Annotate | Download | only in pthread_mutex_lock

Lines Matching defs:mutex

9  *   shall lock the mutex object referenced by 'mutex'.  If the mutex is
10 * already locked, the calling thread shall block until the mutex becomes
11 * available. This operation shall return with the mutex object referenced
12 * by 'mutex' in the locked state with the calling thread as its owner.
15 * -- Initialize a mutex to protect a global variable 'value'
16 * -- Create N threads. Each is looped M times to acquire the mutex,
17 * increase the value, and then release the mutex.
18 * -- Check if the value has increased properly (M*N); a broken mutex
35 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
36 int value; /* value protected by mutex */
57 pthread_mutex_destroy(&mutex);
79 /* Loopd M times to acquire the mutex, increase the value,
80 and then release the mutex. */
83 rc = pthread_mutex_lock(&mutex);
92 fprintf(stderr, "Thread(0x%p) holds the mutex\n", (void *)self);
96 rc = pthread_mutex_unlock(&mutex);