Home | History | Annotate | Download | only in pthread_mutexattr_settype

Lines Matching defs:mutex

12  * Provides errorchecking.  A thread attempting to relock this mutex without unlocking it
13 * first will return with an error. A thread attempting to unlock a mutex which another
15 * mutex will return with an error.
20 * 3. Create a mutex with that mutexattr object.
21 * 4. Attempt to relock a mutex without unlocking it first. It should return an error.
34 pthread_mutex_t mutex;
37 /* Initialize a mutex attributes object */
49 /* Initialize the mutex with that attribute obj. */
50 if (pthread_mutex_init(&mutex, &mta) != 0) {
51 perror("Error intializing the mutex.\n");
55 /* Lock the mutex. */
56 if (pthread_mutex_lock(&mutex) != 0) {
57 perror("Error locking the mutex first time around.\n");
61 /* Lock the mutex again. Here, an error should be returned. */
62 if (pthread_mutex_lock(&mutex) == 0) {
64 ("Test FAILED: Did not return error when locking an already locked mutex.\n");
69 pthread_mutex_unlock(&mutex);
70 pthread_mutex_destroy(&mutex);