pthread_attr_set_getstacksize.3   [plain text]


.\" Copyright (c) 2004-2007 Apple Inc. All rights reserved.
.Dd December 31, 2007
.Dt PTHREAD_ATTR 3
.Os
.Sh NAME
.Nm pthread_attr_getstacksize ,
.Nm pthread_attr_setstacksize
.Nd thread attribute operations
.Sh SYNOPSIS
.Fd #include <pthread.h>
.Ft int
.Fo pthread_attr_getstacksize
.Fa "const pthread_attr_t *restrict attr"
.Fa "size_t *restrict stacksize"
.Fc
.Ft int
.Fo pthread_attr_setstacksize
.Fa "pthread_attr_t *attr"
.Fa "size_t stacksize"
.Fc
.Sh DESCRIPTION
Thread attributes are used to specify parameters to
.Fn pthread_create .
One attribute object can be used in multiple calls to
.Fn pthread_create ,
with or without modifications between calls.
.Pp
The functions 
.Fn pthread_attr_setstacksize
and 
.Fn pthread_attr_getstacksize , 
respectively, set and get the size of the stack that is to be created for the new thread. The stack size attribute is set within the
.Fa attr
argument, which can subsequently be used as an argument to 
.Fn pthread_create .
.Sh RETURN VALUES
If successful, these functions return 0.
Otherwise, an error number is returned to indicate the error. 
.Fn pthread_attr_getstacksize
returns the stacksize attribute value in 
.Fa stacksize 
if successful.
.Sh ERRORS
.Fn pthread_attr_getstacksize
will fail if:
.Bl -tag -width Er
.\" ========
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.El
.Pp
.Fn pthread_attr_setstacksize
will fail if:
.Bl -tag -width Er
.\" ========
.It Bq Er EINVAL
Invalid value for
.Fa attr .
.\" ========
.It Bq Er EINVAL
.Fa stacksize
is less than
.Dv PTHREAD_STACK_MIN .
.\" ========
.It Bq Er EINVAL
.Fa stacksize
is not a multiple of the system page size.
.El
.Sh SEE ALSO
.Xr pthread_create 3 ,
.Xr pthread_attr_init 3 ,
.Xr pthread_attr_setstackaddr 3 
.Sh STANDARDS
.Fn pthread_attr_setstacksize ,
.Fn pthread_attr_getstacksize 
conform to
.St -p1003.1-96