.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/lib/libc_r/man/pthread_setspecific.3,v 1.6.2.4 2001/08/17 15:42:52 ru Exp $
+.\" $FreeBSD$
.\"
.Dd April 4, 1996
.Dt PTHREAD_SETSPECIFIC 3
.Nm pthread_setspecific
.Nd set a thread-specific data value
.Sh SYNOPSIS
-.Fd #include <pthread.h>
+.In pthread.h
.Ft int
-.Fo pthread_setspecific
-.Fa "pthread_key_t key"
-.Fa "const void *value"
-.Fc
+.Fn pthread_setspecific "pthread_key_t key" "const void *value"
.Sh DESCRIPTION
The
.Fn pthread_setspecific
.Fa key
obtained via a previous call to
.Fn pthread_key_create .
-Different threads may bind different values to the same key.
+Different threads can bind different values to the same key.
These values are
typically pointers to blocks of dynamically allocated memory that have been
reserved for use by the calling thread.
The effect of calling
.Fn pthread_setspecific
with a key value not obtained from
-.Fn pthread_key_create ,
+.Fn pthread_key_create
or after
.Fa key
has been deleted with
-.Fn pthread_key_delete ,
+.Fn pthread_key_delete
is undefined.
.Pp
+The
.Fn pthread_setspecific
-may be called from a thread-specific data destructor function;
-however, this may result in lost storage or infinite loops.
+function may be called from a thread-specific data destructor function,
+however this may result in lost storage or infinite loops.
.Sh RETURN VALUES
-If successful, the
+If successful, the
.Fn pthread_setspecific
function will return zero.
-Otherwise, an error number will be returned to indicate the error.
+Otherwise an error number will be returned to
+indicate the error.
.Sh ERRORS
+The
.Fn pthread_setspecific
-will fail if:
+function will fail if:
.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient memory exists to associate the value with the
+.Fa key .
.It Bq Er EINVAL
The
.Fa key
value is invalid.
-.It Bq Er ENOMEM
-Insufficient memory exists to associate the value with the
-.Fa key .
.El
.Sh SEE ALSO
.Xr pthread_getspecific 3 ,
.Xr pthread_key_create 3 ,
.Xr pthread_key_delete 3
.Sh STANDARDS
+The
.Fn pthread_setspecific
-conforms to
+function conforms to
.St -p1003.1-96 .