pthread_setspecific.3 (7f3dea244c40159a41ab22da77a434d7c5b5e85a) pthread_setspecific.3 (c6ff3a1bf74d96278726113478b2c66884aab584)
1.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 33 unchanged lines hidden (view full) ---

42.Fn pthread_setspecific "pthread_key_t key" "const void *value"
43.Sh DESCRIPTION
44The
45.Fn pthread_setspecific
46function associates a thread-specific value with a
47.Fa key
48obtained via a previous call to
49.Fn pthread_key_create .
1.\" Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 33 unchanged lines hidden (view full) ---

42.Fn pthread_setspecific "pthread_key_t key" "const void *value"
43.Sh DESCRIPTION
44The
45.Fn pthread_setspecific
46function associates a thread-specific value with a
47.Fa key
48obtained via a previous call to
49.Fn pthread_key_create .
50Different threads man bind different values to the same key. These values are
50Different threads man bind different values to the same key.
51These values are
51typically pointers to blocks of dynamically allocated memory that have been
52reserved for use by the calling thread.
53.Pp
54The effect of calling
55.Fn pthread_setspecific
56with a key value not obtained from
57.Fn pthread_key_create
58or after
59.Fa key
60has been deleted with
61.Fn pthread_key_delete
62is undefined.
63.Pp
64.Fn pthread_setspecific
65may be called from a thread-specific data destructor function, however this
66may result in lost storage or infinite loops.
67.Sh RETURN VALUES
68If successful, the
69.Fn pthread_setspecific
52typically pointers to blocks of dynamically allocated memory that have been
53reserved for use by the calling thread.
54.Pp
55The effect of calling
56.Fn pthread_setspecific
57with a key value not obtained from
58.Fn pthread_key_create
59or after
60.Fa key
61has been deleted with
62.Fn pthread_key_delete
63is undefined.
64.Pp
65.Fn pthread_setspecific
66may be called from a thread-specific data destructor function, however this
67may result in lost storage or infinite loops.
68.Sh RETURN VALUES
69If successful, the
70.Fn pthread_setspecific
70function will return zero. Otherwise an error number will be returned to
71function will return zero.
72Otherwise an error number will be returned to
71indicate the error.
72.Sh ERRORS
73.Fn pthread_setspecific
74will fail if:
75.Bl -tag -width Er
76.It Bq Er ENOMEM
77Insufficient memory exists to associate the value with the
78.Fa key .

--- 15 unchanged lines hidden ---
73indicate the error.
74.Sh ERRORS
75.Fn pthread_setspecific
76will fail if:
77.Bl -tag -width Er
78.It Bq Er ENOMEM
79Insufficient memory exists to associate the value with the
80.Fa key .

--- 15 unchanged lines hidden ---