Set the thread stack address attribute
#include <pthread.h> int pthread_attr_setstackaddr( pthread_attr_t * attr, void * stackaddr );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The pthread_attr_setstackaddr() function sets the thread stack address attribute in the attribute object attr to stackaddr. If you call this function, you must also call pthread_attr_setstacksize() to set the stack size. Or, you can call pthread_attr_setstack() to set both attributes at the same time.
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.
Standard Unix; removed from POSIX.1-2008
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
The QNX Neutrino interpretation of PTHREAD_STACK_MIN is enough memory to run a thread that does nothing:
void nothingthread( void ) { return; }