[PATCTH,0/2] pthread_mutexattr_setrobust() and pthread_mutex_consistent()
Commit Message
On Wed, Sep 13, 2017 at 05:00:11PM +0200, Michael Kerrisk (man-opages) wrote:
> Hi Yubin
>
> >Hi Michael,
> >
> >Sorry that it took so long.
> >
> >Following is the renew patch. I have corrected several formatting issues (i.e.,
> >\n , - , but I can't find anything wrong with ' ) and some typos. The only
> >issue I cannot solve is that the new `pthread_mutex_consistent(3)` page is too
> >short that it shows at the very bottom... please help with this.
> >
> >Also, please find attached three verification snippets.
>
> I've done some heavy editing, and added quite a few pieces to these pages,
> and pushed the results to Git. Go take a look and let me know
> of anything you think needs fixing. Thanks for these pages!
Good job. No objection, except a minor change and some code formatting change.
See the diff below.
Yubin
Comments
On 09/15/2017 11:45 AM, Yubin Ruan wrote:
> On Wed, Sep 13, 2017 at 05:00:11PM +0200, Michael Kerrisk (man-opages) wrote:
>> Hi Yubin
>>
>>> Hi Michael,
>>>
>>> Sorry that it took so long.
>>>
>>> Following is the renew patch. I have corrected several formatting issues (i.e.,
>>> \n , - , but I can't find anything wrong with ' ) and some typos. The only
>>> issue I cannot solve is that the new `pthread_mutex_consistent(3)` page is too
>>> short that it shows at the very bottom... please help with this.
>>>
>>> Also, please find attached three verification snippets.
>>
>> I've done some heavy editing, and added quite a few pieces to these pages,
>> and pushed the results to Git. Go take a look and let me know
>> of anything you think needs fixing. Thanks for these pages!
>
> Good job. No objection, except a minor change and some code formatting change.
> See the diff below.
Thanks, Yubin. Applied.
Cheers,
Michael
> diff --git a/man3/pthread_mutexattr_setrobust.3 b/man3/pthread_mutexattr_setrobust.3
> index e9e8e76..66b4bed 100644
> --- a/man3/pthread_mutexattr_setrobust.3
> +++ b/man3/pthread_mutexattr_setrobust.3
> @@ -86,7 +86,7 @@ on the mutex will block indefinitely.
> .TP
> .B PTHREAD_MUTEX_ROBUST
> If a mutex is initialized with the
> -.BR PTHREAD_MUTEX_ROBUST ,
> +.BR PTHREAD_MUTEX_ROBUST
> attribute and its owner dies without unlocking it,
> any future attempts to call
> .BR pthread_mutex_lock (3)
> @@ -255,22 +255,21 @@ main(int argc, char *argv[])
> s = pthread_mutex_lock(&mtx);
> if (s == EOWNERDEAD) {
> 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);
> if (s != 0)
> - handle_error_en(s, "pthread_mutex_consistent");
> - printf("[main thread] Mutex is now consistent; unlocking\\n");
> + handle_error_en(s, "pthread_mutex_consistent");
> + printf("[main thread] Mutex is now consistent; unlocking\\n");
> s = pthread_mutex_unlock(&mtx);
> if (s != 0)
> - handle_error_en(s, "pthread_mutex_unlock");
> -
> + handle_error_en(s, "pthread_mutex_unlock");
> exit(EXIT_SUCCESS);
> } else if (s == 0) {
> - printf("[main thread] pthread_mutex_lock() unexpectedly succeeded\\n");
> - exit(EXIT_FAILURE);
> + printf("[main thread] pthread_mutex_lock() unexpectedly succeeded\\n");
> + exit(EXIT_FAILURE);
> } else {
> - printf("[main thread] pthread_mutex_lock() unexpectedly failed\\n");
> - handle_error_en(s, "pthread_mutex_lock");
> + printf("[main thread] pthread_mutex_lock() unexpectedly failed\\n");
> + handle_error_en(s, "pthread_mutex_lock");
> }
> }
>
>
@@ -86,7 +86,7 @@ on the mutex will block indefinitely.
.TP
.B PTHREAD_MUTEX_ROBUST
If a mutex is initialized with the
-.BR PTHREAD_MUTEX_ROBUST ,
+.BR PTHREAD_MUTEX_ROBUST
attribute and its owner dies without unlocking it,
any future attempts to call
.BR pthread_mutex_lock (3)
@@ -255,22 +255,21 @@ main(int argc, char *argv[])
s = pthread_mutex_lock(&mtx);
if (s == EOWNERDEAD) {
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);
if (s != 0)
- handle_error_en(s, "pthread_mutex_consistent");
- printf("[main thread] Mutex is now consistent; unlocking\\n");
+ handle_error_en(s, "pthread_mutex_consistent");
+ printf("[main thread] Mutex is now consistent; unlocking\\n");
s = pthread_mutex_unlock(&mtx);
if (s != 0)
- handle_error_en(s, "pthread_mutex_unlock");
-
+ handle_error_en(s, "pthread_mutex_unlock");
exit(EXIT_SUCCESS);
} else if (s == 0) {
- printf("[main thread] pthread_mutex_lock() unexpectedly succeeded\\n");
- exit(EXIT_FAILURE);
+ printf("[main thread] pthread_mutex_lock() unexpectedly succeeded\\n");
+ exit(EXIT_FAILURE);
} else {
- printf("[main thread] pthread_mutex_lock() unexpectedly failed\\n");
- handle_error_en(s, "pthread_mutex_lock");
+ printf("[main thread] pthread_mutex_lock() unexpectedly failed\\n");
+ handle_error_en(s, "pthread_mutex_lock");
}
}