No, the race condition is in your stack size test (which is written incorrectly), not in the stack creation.
However, this code is inherently race-prone anyway:
pthread_attr_t attr; <initialize attr> pthread_setattr_default_np(&attr) std::thread t(...);
You just need something else in the process using std::thread which does not go through the wrapper you wrote to trigger this.
No, the race condition is in your stack size test (which is written incorrectly), not in the stack creation.
However, this code is inherently race-prone anyway:
pthread_attr_t attr; setattr_ default_ np(&attr)
<initialize attr>
pthread_
std::thread t(...);
You just need something else in the process using std::thread which does not go through the wrapper you wrote to trigger this.