Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_attr_setstackaddr.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_attr_setstackaddr.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_attr_setstackaddr.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_attr_setstackaddr.html on line 8

pthread_attr_setstackaddr()

Set the thread stack address attribute

Synopsis:

#include <pthread.h>

int pthread_attr_setstackaddr( pthread_attr_t * attr,
                               void * stackaddr );

Arguments:

attr
A pointer to the pthread_attr_t structure that defines the attributes to use when creating new threads. For more information, see pthread_attr_init().
stackaddr
A pointer to the block of memory that you want a new thread to use as its stack.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pthread_attr_setstackaddr() function sets the thread stack address attribute in the attribute object attr to stackaddr.

The default value for the thread stack address attribute is NULL. A thread created with a NULL stack address attribute will have a stack dynamically allocated by the system of minimum size PTHREAD_STACK_MIN. If the system allocates a stack, it reclaims the space when the thread terminates. If you allocate a stack, you must free it.


Note:
  • If you provide a stack, the guardsize member of the pthread_attr_t structure is ignored, and there's no stack overflow protection for the thread.
  • The system uses some of the provided stack for objects such as thread local storage and an initial stack frame, so less than the entire buffer is available to the thread.

Returns:

EOK
Success.

Classification:

POSIX 1003.1 THR TSA

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

Caveats:

The QNX interpretation of PTHREAD_STACK_MIN is enough memory to run a thread that does nothing:

void nothingthread( void )
{
    return;
}

See also:

pthread_attr_getstackaddr(), pthread_attr_init(), pthread_create()

Processes and Threads chapter of Getting Started with QNX Neutrino


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_attr_setstackaddr.html on line 173

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pthread_attr_setstackaddr.html on line 173