1.\" $OpenBSD: pthread_attr_init.3,v 1.6 2003/05/18 13:06:33 jmc Exp $
2.\" Manual page derived from TOG's UNIX98 documentation.
3.\"
4.\"  David Leonard, 2000. Public Domain.
5.\"
6.Dd January 6, 2000
7.Dt PTHREAD_ATTR_INIT 3
8.Os
9.Sh NAME
10.Nm pthread_attr_init ,
11.Nm pthread_attr_destroy
12.Nd initialise and destroy threads attribute object
13.Sh SYNOPSIS
14.Fd #include <pthread.h>
15.Ft int
16.Fn pthread_attr_init "pthread_attr_t *attr"
17.Ft int
18.Fn pthread_attr_destroy "pthread_attr_t *attr"
19.Sh DESCRIPTION
20The function
21.Fn pthread_attr_init
22initialises a thread attributes
23object
24.Fa attr
25with the default value for all of the individual
26attributes used by a given implementation.
27.Pp
28The resulting attribute object (possibly modified by setting
29individual attribute values), when used by
30.Xr pthread_create 3 ,
31defines the attributes of the thread created.
32A single attributes object can be used in multiple simultaneous calls to
33.Xr pthread_create 3 .
34.Pp
35The
36.Fn pthread_attr_destroy
37function is used to destroy a thread
38attributes object. An implementation may cause
39.Fn pthread_attr_destroy
40to set
41.Fa attr
42to an implementation-dependent
43invalid value.
44The behaviour of using the attribute after it has
45been destroyed is undefined.
46.Sh RETURN VALUES
47Upon successful completion,
48.Fn pthread_attr_init
49and
50.Fn pthread_attr_destroy
51return a value of 0.
52Otherwise, an error number is returned to indicate the error.
53.Sh ERRORS
54The
55.Fn pthread_attr_init
56function will fail if:
57.Bl -tag -width Er
58.It Bq Er ENOMEM
59Insufficient memory exists to initialise the thread attributes
60object.
61.El
62.Pp
63These functions will not return an error code of
64.Bq Er EINTR .
65.Sh SEE ALSO
66.Xr pthread_attr_setdetachstate 3 ,
67.Xr pthread_attr_setstackaddr 3 ,
68.Xr pthread_attr_setstacksize 3 ,
69.Xr pthread_create 3 ,
70.Xr pthreads 3
71.Sh STANDARDS
72.Fn pthread_create
73conforms to ISO/IEC 9945-1 ANSI/IEEE
74.Pq Dq Tn POSIX
75Std 1003.1 Second Edition 1996-07-12.
76