xref: /openbsd-src/lib/libpthread/man/pthread_attr_init.3 (revision 86f9d4cdda0e0267dccd8755ac0035525579c4a7)
1*86f9d4cdStedu.\" $OpenBSD: pthread_attr_init.3,v 1.11 2013/06/05 03:44:50 tedu Exp $
27682efa6Sd.\" Manual page derived from TOG's UNIX98 documentation.
3084a1742Sjmc.\"
4084a1742Sjmc.\"  David Leonard, 2000. Public Domain.
5084a1742Sjmc.\"
6*86f9d4cdStedu.Dd $Mdocdate: June 5 2013 $
77682efa6Sd.Dt PTHREAD_ATTR_INIT 3
87682efa6Sd.Os
97682efa6Sd.Sh NAME
107682efa6Sd.Nm pthread_attr_init ,
117682efa6Sd.Nm pthread_attr_destroy
127682efa6Sd.Nd initialise and destroy threads attribute object
137682efa6Sd.Sh SYNOPSIS
14*86f9d4cdStedu.In pthread.h
157682efa6Sd.Ft int
167682efa6Sd.Fn pthread_attr_init "pthread_attr_t *attr"
177682efa6Sd.Ft int
187682efa6Sd.Fn pthread_attr_destroy "pthread_attr_t *attr"
197682efa6Sd.Sh DESCRIPTION
207682efa6SdThe function
217682efa6Sd.Fn pthread_attr_init
227682efa6Sdinitialises a thread attributes
237682efa6Sdobject
247682efa6Sd.Fa attr
257682efa6Sdwith the default value for all of the individual
267682efa6Sdattributes used by a given implementation.
277682efa6Sd.Pp
287682efa6SdThe resulting attribute object (possibly modified by setting
297682efa6Sdindividual attribute values), when used by
307682efa6Sd.Xr pthread_create 3 ,
31ee997aeaSmpechdefines the attributes of the thread created.
32ee997aeaSmpechA single attributes object can be used in multiple simultaneous calls to
337682efa6Sd.Xr pthread_create 3 .
347682efa6Sd.Pp
357682efa6SdThe
367682efa6Sd.Fn pthread_attr_destroy
377682efa6Sdfunction is used to destroy a thread
3830fcf885Sjmcattributes object.
3930fcf885SjmcAn implementation may cause
407682efa6Sd.Fn pthread_attr_destroy
417682efa6Sdto set
427682efa6Sd.Fa attr
437682efa6Sdto an implementation-dependent
44ee997aeaSmpechinvalid value.
45ee997aeaSmpechThe behaviour of using the attribute after it has
467682efa6Sdbeen destroyed is undefined.
47ba0a4b2fSjmc.Sh RETURN VALUES
487682efa6SdUpon successful completion,
497682efa6Sd.Fn pthread_attr_init
507682efa6Sdand
517682efa6Sd.Fn pthread_attr_destroy
52ee997aeaSmpechreturn a value of 0.
53ee997aeaSmpechOtherwise, an error number is returned to indicate the error.
547682efa6Sd.Sh ERRORS
557682efa6SdThe
567682efa6Sd.Fn pthread_attr_init
577682efa6Sdfunction will fail if:
587682efa6Sd.Bl -tag -width Er
597682efa6Sd.It Bq Er ENOMEM
607682efa6SdInsufficient memory exists to initialise the thread attributes
617682efa6Sdobject.
627682efa6Sd.El
637682efa6Sd.Pp
647682efa6SdThese functions will not return an error code of
657682efa6Sd.Bq Er EINTR .
667682efa6Sd.Sh SEE ALSO
6779ad192cSjmc.Xr pthread_attr_setdetachstate 3 ,
6891063d07Sguenther.Xr pthread_attr_setguardsize 3 ,
6911ddadc0Sguenther.Xr pthread_attr_setstack 3 ,
707682efa6Sd.Xr pthread_attr_setstackaddr 3 ,
717682efa6Sd.Xr pthread_attr_setstacksize 3 ,
727682efa6Sd.Xr pthread_create 3 ,
737682efa6Sd.Xr pthreads 3
747682efa6Sd.Sh STANDARDS
7511ddadc0Sguenther.Fn pthread_attr_destroy
7611ddadc0Sguentherand
7711ddadc0Sguenther.Fn pthread_attr_init
7811ddadc0Sguentherconform to ISO/IEC 9945-1 ANSI/IEEE
797682efa6Sd.Pq Dq Tn POSIX
807682efa6SdStd 1003.1 Second Edition 1996-07-12.
81