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

  man pages->Tru64 Unix man pages -> pthread_attr_setguardsize (3)              
Title
Content
Arch
Section
 

pthread_attr_setguardsize(3)

Contents


NAME    [Toc]    [Back]

       pthread_attr_setguardsize    -   Changes   the   guardsize
       attribute of the specified thread attributes object

SYNOPSIS    [Toc]    [Back]

       #include <pthread.h>

       int pthread_attr_setguardsize(
               pthread_attr_t *attr,
               size_t guardsize );

LIBRARY    [Toc]    [Back]

       DECthreads POSIX 1003.1c Library (libpthread.so)

STANDARDS    [Toc]    [Back]

       Interfaces documented on this reference  page  conform  to
       industry standards as follows:

       IEEE  Std  1003.1c-1995,  POSIX System Application Program
       Interface

PARAMETERS    [Toc]    [Back]

       Address of the thread attributes  object  whose  guardsize
       attribute  is to be modified.  New value for the guardsize
       attribute of the thread  attributes  object  specified  by
       attr.

DESCRIPTION    [Toc]    [Back]

       This  routine  uses  the  value specified in the guardsize
       argument to set the  guardsize  attribute  of  the  thread
       attributes object specified in the attr argument.

       When  creating a thread, use a thread attributes object to
       specify  nondefault  values  for  thread  attributes.  The
       guardsize  attribute  of a thread attributes object specifies
 the minimum size (in bytes) of the guard area for the
       stack of a new thread.

       A  guard  area, with its associated overflow warning area,
       can help a multithreaded  program  detect  overflow  of  a
       thread's stack. A guard area is a region of no-access memory
 that DECthreads allocates at the overflow end  of  the
       thread's  stack,  following  the thread's overflow warning
       area. If any thread attempts  to  write  in  the  overflow
       warning area, a stack overflow exception occurs. Your program
 can catch this exception and continue  processing  as
       long  as the thread does not attempt to write in the guard
       area. When any thread attempts to access a memory location
       within  the  guard  area,  a  memory  addressing violation
       occurs without the possibility of recovery.

       A new thread can  be  created  with  a  default  guardsize
       attribute  value.   This  value is platform dependent, but
       will always be at least  one  "hardware  protection  unit"
       (that  is,  at  least one page). For more information, see
       the platform-specific appendixes of Guide to DECthreads.

       After this routine is  called,  due  to  platform-specific
       factors  DECthreads  might reserve a larger guard area for
       the new thread than was specified in the  guardsize  argument.
  For  more  information,  see  the platform-specific
       appendixes of Guide to DECthreads.

       DECthreads allows your program to specify the  size  of  a
       thread  stack's  guard area for two reasons: When a thread
       allocates large data structures on its stack, a guard area
       with  a  size  greater  than  the  default  size  might be
       required to detect stack overflow.  Overflow protection of
       a  thread's  stack can potentially waste system resources,
       such as for an application that creates a large number  of
       threads that will never overflow their stacks. Your multithreaded
 program can conserve system resources by "turning
       off" a thread's stack guard area--that is, by specifying a
       guardsize attribute of zero.

       If a thread is created using a  thread  attributes  object
       whose    stackaddr    attribute    is   set   (using   the
       pthread_attr_setstackaddr(3)   routine),   this    routine
       ignores  the  object's guardsize attribute and provides no
       thread stack guard area for the new thread.

RETURN VALUES    [Toc]    [Back]

       If an error condition  occurs,  this  routine  returns  an
       integer  value  indicating  the  type  of  error. Possible
       return values are as follows: Successful completion.   The
       argument  attr is not a valid thread attributes object, or
       the argument guardsize contains an invalid value.

ERRORS    [Toc]    [Back]

       None

SEE ALSO    [Toc]    [Back]

      
      
       Functions:  pthread_attr_init(3),   pthread_attr_getguardsize(3), pthread_attr_setstacksize(3), pthread_create(3)

       Manuals: Guide to DECthreads and Programmer's Guide



                                     pthread_attr_setguardsize(3)
[ Back ]
 Similar pages
Name OS Title
pthread_attr_getguardsize Tru64 Obtains the guardsize attribute of the specified thread attributes object
pthread_attr_setguardsize IRIX get or set the thread guardsize attribute
pthread_attr_getname_np Tru64 Obtain the object name attribute in a thread attributes object
pthread_attr_setname_np Tru64 Change the object name attribute in a thread attributes object
pthread_attr_setstacksize Tru64 Changes the stacksize attribute in the specified thread attributes object
pthread_attr_setdetachstate Tru64 Changes the detachstate attribute in the specified thread attributes object
pthread_attr_setstackaddr Tru64 Changes the stack address attribute of the specified thread attributes object
pthread_attr_getdetachstate Tru64 Obtains the detachstate attribute of the specified thread attributes object
pthread_attr_setschedpolicy Tru64 Changes the scheduling policy attribute of the specified thread attributes object
pthread_attr_setinheritsched Tru64 Changes the inherit scheduling attribute of the specified thread attributes object
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service