thread/Thread: add debug attribute "inside_handle"
This attribute shall be used only for IsInside() to make this safe against a race condition described in #188: > There is no requirement on the implementation that the ID of the > created thread be available before the newly created thread starts > executing. http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_create.html): This means that on some pthread implementations (e.g. Haiku), the assert(thread.IsInside()) could fail. Closes #188
This commit is contained in:
@@ -86,6 +86,10 @@ Thread::ThreadProc(void *ctx)
|
||||
{
|
||||
Thread &thread = *(Thread *)ctx;
|
||||
|
||||
#ifndef NDEBUG
|
||||
thread.inside_handle = pthread_self();
|
||||
#endif
|
||||
|
||||
thread.Run();
|
||||
|
||||
return nullptr;
|
||||
|
Reference in New Issue
Block a user