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.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1844022

Title:
  pthread_setattr_default_np race condition with pthread_create.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1844022/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to