pthread_attr_setstacksize

Sets the stack size of a thread attribute object.

Library:LibC
Classification:POSIX
Service:Threads

Syntax

  #include <pthread.h>
   
  int   pthread_attr_setstacksize (
     pthread_attr_t   *attr,
     size_t            stacksize);
  

Parameters

attr

(IN) Points to the attribute structure.

stacksize

(IN) Specifies the size of the stack.

Return Values

If successful, returns zero; otherwise returns a nonzero error code:

Decimal

Constant

Description

9

EINVAL

The stacksize is less than PTHREAD_STACK_MIN.

Remarks

The pthread_attr_init function initializes the stack to the PTHREAD_STACK_MIN. If you want to modify the size of the stack, you must do so before you create a thread. Once a thread has been created with an attribute object, the stack size cannot be modified.

See Also