pthread_attr_setdefaultstacksize()
Set the default stack size
Synopsis:
#include <pthread.h>
int pthread_attr_setdefaultstacksize(size_t const stacksize);
Arguments:
- stacksize
- The new default stack size.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The
pthread_attr_setdefaultstacksize() function sets the default
stack size for created threads without explicitly overriding this value in the
attribute structure. The size specified by this function affects:
- A pthread_attr_t initialized by pthread_attr_init().
- Threads created by pthread_create() with the attr parameter passed as NULL.
This function is most useful for controlling the stack size in cases where thread creation details are hidden by the API (e.g., C++ threading classes).
Note:
The system uses some of the provided stack for objects such as thread local
storage and an initial stack frame, so the entire stack size isn't available to the
thread.
Returns:
- EOK
- Success.
- EINVAL
- The value of stacksize is less than PTHREAD_STACK_MIN.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Yes |
Caveats:
The QNX OS interpretation of PTHREAD_STACK_MIN is enough memory to run a thread that does nothing:
void *nothingthread( void *ignored )
{
return NULL;
}
Page updated: