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