Module Name: src Committed By: wiz Date: Sat Apr 27 10:57:12 UTC 2019
Modified Files: src/lib/libpthread: call_once.3 cnd.3 mtx.3 thrd.3 threads.3 tss.3 Log Message: Fix some typos, improve wording. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libpthread/call_once.3 \ src/lib/libpthread/cnd.3 src/lib/libpthread/mtx.3 \ src/lib/libpthread/threads.3 src/lib/libpthread/tss.3 cvs rdiff -u -r1.2 -r1.3 src/lib/libpthread/thrd.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libpthread/call_once.3 diff -u src/lib/libpthread/call_once.3:1.1 src/lib/libpthread/call_once.3:1.2 --- src/lib/libpthread/call_once.3:1.1 Wed Apr 24 11:43:19 2019 +++ src/lib/libpthread/call_once.3 Sat Apr 27 10:57:11 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: call_once.3,v 1.1 2019/04/24 11:43:19 kamil Exp $ +.\" $NetBSD: call_once.3,v 1.2 2019/04/27 10:57:11 wiz Exp $ .\" .\" Copyright (c) 2016 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -38,7 +38,7 @@ .Sh SYNOPSIS .In threads.h .Ft void -.Fn call_once "once_flag *flag" "void (*func)(void))" +.Fn call_once "once_flag *flag" "void (*func)(void)" .Vt #define ONCE_FLAG_INIT /* implementation specified */ .Sh DESCRIPTION The Index: src/lib/libpthread/cnd.3 diff -u src/lib/libpthread/cnd.3:1.1 src/lib/libpthread/cnd.3:1.2 --- src/lib/libpthread/cnd.3:1.1 Wed Apr 24 11:43:19 2019 +++ src/lib/libpthread/cnd.3 Sat Apr 27 10:57:11 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: cnd.3,v 1.1 2019/04/24 11:43:19 kamil Exp $ +.\" $NetBSD: cnd.3,v 1.2 2019/04/27 10:57:11 wiz Exp $ .\" .\" Copyright (c) 2016 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -72,7 +72,7 @@ condition variable. .Pp The .Fn cnd_init -function initializes new +function initializes a new .Fa cond variable. .Pp @@ -81,13 +81,13 @@ The function unblock one thread that currently waits on the .Fa cond variable. -If there are no threads blocked +If there are no threads blocked, .Fn cnd_signal does nothing and returns success. .Pp The .Fn cnd_timedwait -function atomicalyl unlocks the mutex +function atomically unlocks the mutex .Fa mtx and blocks on the condition variable .Fa cond @@ -109,7 +109,7 @@ The .Fn cnd_wait function atomically unlocks the mutex .Fa mtx -and tries to blocks on on the conditional variable +and tries to block on the conditional variable .Fa cond until a thread is signalled by a call to .Fn cnd_signal @@ -121,7 +121,7 @@ mutex is locked again before the functio If the mutex is not locked by the calling thread then behavior is undefined. .Sh RETURN VALUES The -.Fn cnd_broadcast , +.Fn cnd_broadcast function returns .Dv thrd_success on success or @@ -131,6 +131,8 @@ on failure. The .Fn cnd_destroy function returns no value. +.Pp +The .Fn cnd_init function returns .Dv thrd_success @@ -153,7 +155,7 @@ function returns on success, otherwise .Dv thrd_timedout to indicate that system time has reached or exceeded the time specified in -.Dv ts +.Dv ts , or .Dv thrd_error on failure. @@ -162,7 +164,7 @@ The .Fn cnd_wait function returns .Dv thrd_success -on success, otherwise +on success or .Dv thrd_error on failure. .Sh SEE ALSO Index: src/lib/libpthread/mtx.3 diff -u src/lib/libpthread/mtx.3:1.1 src/lib/libpthread/mtx.3:1.2 --- src/lib/libpthread/mtx.3:1.1 Wed Apr 24 11:43:19 2019 +++ src/lib/libpthread/mtx.3 Sat Apr 27 10:57:11 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: mtx.3,v 1.1 2019/04/24 11:43:19 kamil Exp $ +.\" $NetBSD: mtx.3,v 1.2 2019/04/27 10:57:11 wiz Exp $ .\" .\" Copyright (c) 2016 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -72,13 +72,13 @@ The allowed values of are as follows: .Bl -column "mtx_plain | mtx_recursive" .It Sy "Type" Ta Sy "Description" -.It Xr mtx_plain Ta basic mutex -.It Xr mtx_timed Ta mutex with timeout support -.It Xr mtx_plain | mtx_recursive Ta basic recursive mutex -.It Xr mtx_timed | mtx_recursive Ta recursive mutex with timeout support +.It Dv mtx_plain Ta basic mutex +.It Dv mtx_timed Ta mutex with timeout support +.It Dv mtx_plain | Dv mtx_recursive Ta basic recursive mutex +.It Dv mtx_timed | Dv mtx_recursive Ta recursive mutex with timeout support .El .Pp -The underlaying +The underlying .Nx implementation of mutex types does not distinguish between .Dv mtx_plain @@ -91,17 +91,17 @@ The function locks the .Fa mtx object. -It is required the never lock multiple times the same +It is required to never lock the same .Fa mtx object without the .Dv mtx_recursive -property. +property multiple times. If the .Fa mtx object is already locked by another thread, -caller of +the caller of .Fa mtx_lock -blocks until lock becomes available. +blocks until the lock becomes available. .Pp The .Fn mtx_timedlock @@ -109,7 +109,7 @@ function tries to lock the .Fa mtx object. In case of blocked resource by another thread, -this call blocks with specified timeout in the +this call blocks for the specified timeout in the .Fa ts argument. The timeout argument is @@ -117,16 +117,16 @@ The timeout argument is based time of .Dv timespec type. -It is required the never lock multiple times the same +It is required to never lock the same .Fa mtx object without the .Dv mtx_recursive -property. -In portable code there must be used +property multiple times. +In portable code, a .Fa mtx object with the .Dv mtx_recursive -property. +property must be used in such a case. .Pp The .Fn mtx_trylock @@ -142,7 +142,9 @@ The function unlocks the .Fa mtx object. -This call must be proceded with lock by the calling thread. +This call must be preceded with a matching +.Fn mtx_lock +call in the same thread. .Sh RETURN VALUES The .Fn mtx_destroy @@ -172,7 +174,7 @@ on success, otherwise .Dv thrd_timedout to indicate that system time has reached or exceeded the time specified in -.Dv ts +.Dv ts , or .Dv thrd_error on failure. @@ -186,7 +188,7 @@ otherwise .Dv thrd_timedout to indicate that .Fa mtx -object is already locked or +object is already locked, or .Dv thrd_error on failure. .Pp @@ -199,7 +201,7 @@ otherwise .Dv thrd_timedout to indicate that .Fa mtx -object is already locked or +object is already locked, or .Dv thrd_error on failure. .Sh SEE ALSO Index: src/lib/libpthread/threads.3 diff -u src/lib/libpthread/threads.3:1.1 src/lib/libpthread/threads.3:1.2 --- src/lib/libpthread/threads.3:1.1 Wed Apr 24 11:43:19 2019 +++ src/lib/libpthread/threads.3 Sat Apr 27 10:57:11 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: threads.3,v 1.1 2019/04/24 11:43:19 kamil Exp $ +.\" $NetBSD: threads.3,v 1.2 2019/04/27 10:57:11 wiz Exp $ .\" .\" Copyright (c) 2016 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -28,7 +28,7 @@ .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd October 16, 2016 -.Dt THREDS 3 +.Dt THREADS 3 .Os .Sh NAME .Nm threads @@ -38,7 +38,7 @@ .Sh SYNOPSIS .In threads.h .Sh DESCRIPTION -Portable Threads library provides an implementation of portable threading +The C11 thread support library provides an implementation of a portable threading interface, built on top of the .Xr pthread 3 native interfaces. @@ -72,12 +72,12 @@ Thread-specifig storage functions. .It Xr mtx_unlock 3 Ta unlocks a mutex .It Xr thrd_create 3 Ta creates a thread executing a function with a parameter .It Xr thrd_current 3 Ta identifies the thread that called this function -.It Xr thrd_detach 3 Ta dispose of resources allocatd to a thread on exit -.It Xr thrd_equal 3 Ta determines whether two threads reffer the same thread +.It Xr thrd_detach 3 Ta dispose of resources allocated to a thread on exit +.It Xr thrd_equal 3 Ta determines whether two threads refer the same thread .It Xr thrd_exit 3 Ta terminates a calling thread and sets its result code .It Xr thrd_join 3 Ta joins a thread with the current one and blocks .It Xr thrd_sleep 3 Ta suspends a calling thread until a signal or timeout -.It Xr tss_create 3 Ta crates a thread-specific storage pointer with a dtor +.It Xr tss_create 3 Ta creates a thread-specific storage pointer with a destructor .It Xr tss_delete 3 Ta releases resources used by a thread-specific storage .It Xr tss_get 3 Ta gets a value of thread-specific storage from a key .It Xr tss_set 3 Ta sets a value of thread-specific storage to a key Index: src/lib/libpthread/tss.3 diff -u src/lib/libpthread/tss.3:1.1 src/lib/libpthread/tss.3:1.2 --- src/lib/libpthread/tss.3:1.1 Wed Apr 24 11:43:19 2019 +++ src/lib/libpthread/tss.3 Sat Apr 27 10:57:11 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: tss.3,v 1.1 2019/04/24 11:43:19 kamil Exp $ +.\" $NetBSD: tss.3,v 1.2 2019/04/27 10:57:11 wiz Exp $ .\" .\" Copyright (c) 2016 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -58,7 +58,7 @@ global storage. .Pp Multithreaded programs in C add the third group .Sy thread-specific storage . -This data is private to thread and every entry of this type has associated +This data is private to thread and every entry of this type has an associated .Dv tss_t opaque key that is global to all threads in the process. A thread using the @@ -74,34 +74,30 @@ handler with optional destructor If the .Fa dtor parameter is not -.Dv NULL +.Dv NULL , then specified appropriate destructor will be called on thread termination. -Destructor is not called if a thread called the +The destructor is not called if a thread called the .Fn tss_delete function for the specified .Fa key . -If, -after all the destructors have been called for all -.Dv non-NULL +If, after all the destructors have been called for all +.Pf non- Dv NULL +values with associated destructors, +there are still some +.Pf non- Dv NULL values with associated destructors, -ther are still some -.Dv non-NULL values with -associated destructors, then the process is repeated. -If, -after at least +If, after at least .Dv TSS_DTOR_ITERATIONS iterations of destructor calls for outstanding -.Dv non-NULL -values, -there are still some -.Dv non-NULL -values with associated destructors, -the +.Pf non- Dv NULL +values, there are still some +.Pf non- Dv NULL +values with associated destructors, the .Nx -implementation stops further calling destructors. +implementation stops calling further destructors. The -.Xr thrd_exit +.Xr thrd_exit 3 function must not be called from a destructor. .Pp The @@ -111,8 +107,7 @@ function frees resources used by the thr object. This function can be called inside the .Fa dtor -destructor, -however the destructor is not called by +destructor, however the destructor is not called by .Fn tss_delete . .Pp The Index: src/lib/libpthread/thrd.3 diff -u src/lib/libpthread/thrd.3:1.2 src/lib/libpthread/thrd.3:1.3 --- src/lib/libpthread/thrd.3:1.2 Wed Apr 24 18:47:54 2019 +++ src/lib/libpthread/thrd.3 Sat Apr 27 10:57:11 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: thrd.3,v 1.2 2019/04/24 18:47:54 kamil Exp $ +.\" $NetBSD: thrd.3,v 1.3 2019/04/27 10:57:11 wiz Exp $ .\" .\" Copyright (c) 2016 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -57,7 +57,7 @@ .Sh DESCRIPTION The .Nm -interface operates over opaque object of the +interface operates over opaque objects of the .Dv thrd_t type. .Pp @@ -65,12 +65,12 @@ The .Fn thrd_create function is used to create a new thread, calling .Fa func -with +with the .Fa arg parameter. This function initializes the .Fa thr -object with the identifier of newly created thread. +object with the identifier of the newly created thread. The completion of .Fn thrd_create is synchronized with the start of the newly produced thread. @@ -81,13 +81,13 @@ operation or been detached. .Pp The .Fn thrd_current -function returns thread identifier. +function returns the thread identifier of the current thread. .Pp The .Fn thrd_detach function is used to indicate that storage for the .Fa thr -object can be reclaimed on thread's termination. +object can be reclaimed on the thread's termination. The .Fa thr object cannot be already detached or joined. @@ -102,13 +102,13 @@ objects refer to the same thread. .Pp The .Fn thrd_exit -function terminates calling thread and passes the +function terminates the calling thread and passes the .Fa res -value, that might be read by the +value that might be read by the .Fn thrd_join function. -The program terminates once all threads has been terminated with -result equivalent to calling the +The program terminates once all threads have been terminated with +an exit code equivalent to calling the .Xr exit 3 function with the .Dv EXIT_SUCCESS @@ -139,7 +139,7 @@ argument has been passed. The .Fa remaining parameter stores requested timeout reduced with the time actually suspended. -This argument is used when the +This argument is used when .Fn thrd_sleep has been interrupted. It is valid code to point both arguments @@ -147,10 +147,10 @@ It is valid code to point both arguments and .Fa remaining to the same object. -It is not guaranteed that sleep will not take longer than specified +It is not guaranteed that sleep will not take longer than specified in .Fa duration , however unless interrupted with a signal it will not take shorter -than specified interval. +than the specified interval. .Pp The .Fn thrd_yield @@ -163,13 +163,13 @@ function returns .Dv thrd_success on success, otherwise .Dv thrd_nomem -if not sufficient memory could be allocated or +if not sufficient memory could be allocated, or .Dv thrd_error -on other error. +on other errors. .Pp The .Fn thrd_current -function returns identifier of the calling thread. +function returns the identifier of the calling thread. .Pp The .Fn thrd_detach @@ -202,21 +202,16 @@ on failure. .Pp The .Fn thrd_sleep -function returns -.Dv 0 -on success (as the requested time has elapsed), -.Dv -1 -once the function was interrupted by a signal +function returns 0 on success (as the requested time has elapsed), +\-1 once the function was interrupted by a signal, or a negative value to indicate error. The .Nx -implementation returns -.Dv -2 -on error. +implementation returns \-2 on error. .Pp The .Fn thrd_yield -returns no value. +function returns no value. .Sh SEE ALSO .Xr nanosleep 2 , .Xr pthread_create 3 ,