mirror of https://github.com/mkerrisk/man-pages
pthread_mutexattr_setrobust.3: Minor fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
336e15b267
commit
91fd35ad46
|
@ -86,7 +86,7 @@ on the mutex will block indefinitely.
|
||||||
.TP
|
.TP
|
||||||
.B PTHREAD_MUTEX_ROBUST
|
.B PTHREAD_MUTEX_ROBUST
|
||||||
If a mutex is initialized with the
|
If a mutex is initialized with the
|
||||||
.BR PTHREAD_MUTEX_ROBUST ,
|
.BR PTHREAD_MUTEX_ROBUST
|
||||||
attribute and its owner dies without unlocking it,
|
attribute and its owner dies without unlocking it,
|
||||||
any future attempts to call
|
any future attempts to call
|
||||||
.BR pthread_mutex_lock (3)
|
.BR pthread_mutex_lock (3)
|
||||||
|
@ -255,22 +255,22 @@ main(int argc, char *argv[])
|
||||||
s = pthread_mutex_lock(&mtx);
|
s = pthread_mutex_lock(&mtx);
|
||||||
if (s == EOWNERDEAD) {
|
if (s == EOWNERDEAD) {
|
||||||
printf("[main thread] pthread_mutex_lock() returned EOWNERDEAD\\n");
|
printf("[main thread] pthread_mutex_lock() returned EOWNERDEAD\\n");
|
||||||
printf("[main thread] Now make the mutex consistent\\n");
|
printf("[main thread] Now make the mutex consistent\\n");
|
||||||
s = pthread_mutex_consistent(&mtx);
|
s = pthread_mutex_consistent(&mtx);
|
||||||
if (s != 0)
|
if (s != 0)
|
||||||
handle_error_en(s, "pthread_mutex_consistent");
|
handle_error_en(s, "pthread_mutex_consistent");
|
||||||
printf("[main thread] Mutex is now consistent; unlocking\\n");
|
printf("[main thread] Mutex is now consistent; unlocking\\n");
|
||||||
s = pthread_mutex_unlock(&mtx);
|
s = pthread_mutex_unlock(&mtx);
|
||||||
if (s != 0)
|
if (s != 0)
|
||||||
handle_error_en(s, "pthread_mutex_unlock");
|
handle_error_en(s, "pthread_mutex_unlock");
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
} else if (s == 0) {
|
} else if (s == 0) {
|
||||||
printf("[main thread] pthread_mutex_lock() unexpectedly succeeded\\n");
|
printf("[main thread] pthread_mutex_lock() unexpectedly succeeded\\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
} else {
|
} else {
|
||||||
printf("[main thread] pthread_mutex_lock() unexpectedly failed\\n");
|
printf("[main thread] pthread_mutex_lock() unexpectedly failed\\n");
|
||||||
handle_error_en(s, "pthread_mutex_lock");
|
handle_error_en(s, "pthread_mutex_lock");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.EE
|
.EE
|
||||||
|
|
Loading…
Reference in New Issue