X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/ba379fdc102753d6be2c4d937058fe40257329fe..4e4e5a6f2694187498445a6ac6f1634ce8141119:/wtf/Threading.cpp?ds=sidebyside diff --git a/wtf/Threading.cpp b/wtf/Threading.cpp index bd25ee7..49de59e 100644 --- a/wtf/Threading.cpp +++ b/wtf/Threading.cpp @@ -30,7 +30,7 @@ namespace WTF { -struct NewThreadContext { +struct NewThreadContext : FastAllocBase { NewThreadContext(ThreadFunction entryPoint, void* data, const char* name) : entryPoint(entryPoint) , data(data) @@ -49,13 +49,14 @@ static void* threadEntryPoint(void* contextData) { NewThreadContext* context = reinterpret_cast(contextData); - setThreadNameInternal(context->name); - - // Block until our creating thread has completed any extra setup work + // Block until our creating thread has completed any extra setup work, including + // establishing ThreadIdentifier. { MutexLocker locker(context->creationMutex); } + initializeCurrentThreadInternal(context->name); + // Grab the info that we need out of the context, then deallocate it. ThreadFunction entryPoint = context->entryPoint; void* data = context->data; @@ -75,7 +76,7 @@ ThreadIdentifier createThread(ThreadFunction entryPoint, void* data, const char* NewThreadContext* context = new NewThreadContext(entryPoint, data, name); - // Prevent the thread body from executing until we've established the thread identifier + // Prevent the thread body from executing until we've established the thread identifier. MutexLocker locker(context->creationMutex); return createThreadInternal(threadEntryPoint, context, name);