Updated: April 19, 2023 |
Set the thread-creation stack attributes
#include <pthread.h> int pthread_attr_setstack( pthread_attr_t *attr, void *stackaddr, size_t stacksize );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The pthread_attr_setstack() function sets the stack attributes that specify the area of storage to be used for the created thread's stack. The value of stacksize must be at least PTHREAD_STACK_MIN.
When you specify the storage area for the stack, the process manager won't create a guard page. We recommend that you create an inaccessible guard page at the end of the stack (i.e. immediately before the lowest address) so the process manager can detect stack overflow. By inaccessible, we mean it should be assigned the PROT_NONE access type; for more information, see the mmap() reference.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |