*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> pthread_attr_init (3p)              
Title
Content
Arch
Section
 

Contents


pthread_attr_init(3P)					 pthread_attr_init(3P)


NAME    [Toc]    [Back]

     pthread_attr_init,	pthread_attr_destroy, pthread_attr_setstacksize,
     pthread_attr_getstacksize,	pthread_attr_setstackaddr,
     pthread_attr_getstackaddr,	pthread_attr_setdetachstate,
     pthread_attr_getdetachstate - initialize thread attributes

C SYNOPSIS    [Toc]    [Back]

     #include <pthread.h>

     int pthread_attr_init(pthread_attr_t *attr);
     int pthread_attr_destroy(pthread_attr_t *attr);
     int pthread_attr_setstacksize(pthread_attr_t *attr, size_t	size);
     int pthread_attr_getstacksize(const pthread_attr_t	*attr, size_t *size);
     int pthread_attr_setstackaddr(pthread_attr_t *attr, void *addr);
     int pthread_attr_getstackaddr(const pthread_attr_t	*attr, void **addr);
     int pthread_attr_setdetachstate(pthread_attr_t *attr, int detach);
     int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detach);

DESCRIPTION    [Toc]    [Back]

     A thread attributes object	is a collection	of values which	specify	how a
     thread is created [see pthread_create()].	Changes	to the attribute
     values of the object do not affect	threads	already	created	using the
     object.  Size and location	of the stack may be specified as well as the
     detached state [see pthread_detach()] and scheduling attributes [see
     pthread_attr_setscope() and pthread_attr_setinheritsched(3P)].

     The pthread_attr_init() function initializes the thread attributes	object
     specified by attr and the function	pthread_attr_destroy() destroys	it.

     The stack size attribute is the minimum number of bytes used by a thread
     for its stack.  It	is set in the object attr to the value of size using
     pthread_attr_setstacksize().  The current stack size for the attribute
     object attr is returned in	the size parameter of
     pthread_attr_getstacksize().  The best way	to find	the default stacksize
     is	to retrieve it from an initialized attribute object.  In IRIX this
     value is 0x20000 (128k) bytes.

     The stack address attribute is the	address	of storage allocated by	the
     user that a thread	will use as its	stack.	It is set in the object	attr
     to	the value of addr using	pthread_attr_setstackaddr().  If an address is
     specified it must reference memory	of at least the	size indicated by the
     stack size	attribute value.  When no attribute value is specified memory
     will be allocated at an address chosen by the library and disposed	of
     when the thread terminates.  The current stack address for	the attribute
     object attr is returned in	the addr parameter of
     pthread_attr_getstackaddr().  It is meaningless to	request	a value	for
     the address attribute if none has been set.

     The detach	state attribute	determines whether storage for the thread will
     be	reclaimed when it terminates.  It is set in the	object attr to the
     value of detach using pthread_attr_setdetachstate().  A value of either
     PTHREAD_CREATE_JOINABLE (which is the default) or PTHREAD_CREATE_DETACHED



									Page 1






pthread_attr_init(3P)					 pthread_attr_init(3P)



     should be specified.  The initial thread is created with the detach state
     of	PTHREAD_CREATE_JOINABLE.  The current detach state for the attribute
     object attr is returned in	the detach parameter of
     pthread_attr_getdetachstate().

DIAGNOSTICS    [Toc]    [Back]

     On	success	the attribute functions	return zero; otherwise they return an
     error number.

     pthread_attr_setstacksize() can return the	following error:

     [EINVAL]	    The	stack size specified by	size is	too small [see NOTES].

     pthread_attr_setstackaddr() can return the	following error:

     [EINVAL]	    The	stack address specified	by addr	is illegal.

     pthread_attr_setdetachstate() can return the following error:

     [EINVAL]	    The	value of detach	is neither PTHREAD_CREATE_JOINABLE nor
		    PTHREAD_CREATE_DETACHED.

SEE ALSO    [Toc]    [Back]

      
      
     pthread_create(3P), pthread_detach(3P), sysconf(3C).

NOTES    [Toc]    [Back]

     The minimum stack size can	be retrieved using sysconf(3C) using the
     THREAD_STACK_MIN option.


									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
pthread_rwlockattr_init Tru64 Initialize a read-write lock attributes object
pthread_attr_get_np FreeBSD get attributes of existent thread
pthread_attr_setinheritsched IRIX thread scheduling inheritance attributes
pthread_attr_setscope IRIX thread scheduling scope attributes
pthread_attr_init Tru64 Initializes a thread attributes object
pthread_attr_destroy Tru64 Destroys a thread attributes object
pthread_attr_setstacksize Tru64 Changes the stacksize attribute in the specified thread attributes object
pthread_attr_setschedparam IRIX manage thread scheduling priority attributes
pthread_attr_setguardsize Tru64 Changes the guardsize attribute of the specified thread attributes object
pthread_attr_setdetachstate Tru64 Changes the detachstate attribute in the specified thread attributes object
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service