Use thr_min_stack(3T) to get the minimum stack size for a thread.
#include <thread.h> size_t thr_min_stack(void);
A thread that does more than execute a null procedure should allocate a stack size greater than the size of thr_min_stack().
When a thread is created with a user-supplied stack, the user must reserve enough space to run the thread. In a dynamically linked execution environment, it is difficult to know what the thread minimal stack requirements are.
Most users should not create threads with user-supplied stacks. User-supplied stacks exist only to support applications that require complete control over their execution environments.
Instead, users should let the threads library manage stack allocation. The threads library provides default stacks that should meet the requirements of any created thread.