I assume the code in another_thread attempts to obtain the size of the current thread. But the code just reads back the default stack size, which may have changed due to the set_default_thread_stack_size call.
One way to obtain the size of the current thread stack is this call:
I assume the code in another_thread attempts to obtain the size of the current thread. But the code just reads back the default stack size, which may have changed due to the set_default_ thread_ stack_size call.
One way to obtain the size of the current thread stack is this call:
if(int err = ::pthread_ getattr_ np(pthread_ self(), &attr))
throw std::system_ error(err, std::system_ category( ), "pthread_ getattr_ np");
This should give consistent results all the time.