Changeset 41626 in webkit


Ignore:
Timestamp:
Mar 12, 2009, 8:01:46 AM (16 years ago)
Author:
Adam Roben
Message:

Adopt setThreadNameInternal on Windows

Also changed a Windows-only assertion about thread name length to an
all-platform log message.

Reviewed by Adam Treat.

  • wtf/Threading.cpp: (WTF::createThread): Warn if the thread name is longer than 31 characters, as Visual Studio will truncate names longer than that length.
  • wtf/ThreadingWin.cpp: (WTF::setThreadNameInternal): Renamed from setThreadName and changed to always operate on the current thread. (WTF::initializeThreading): Changed to use setThreadNameInternal. (WTF::createThreadInternal): Removed call to setThreadName. This is now handled by threadEntryPoint and setThreadNameInternal.
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r41613 r41626  
     12009-03-12  Adam Roben  <[email protected]>
     2
     3        Adopt setThreadNameInternal on Windows
     4
     5        Also changed a Windows-only assertion about thread name length to an
     6        all-platform log message.
     7
     8        Reviewed by Adam Treat.
     9
     10        * wtf/Threading.cpp:
     11        (WTF::createThread): Warn if the thread name is longer than 31
     12        characters, as Visual Studio will truncate names longer than that
     13        length.
     14
     15        * wtf/ThreadingWin.cpp:
     16        (WTF::setThreadNameInternal): Renamed from setThreadName and changed
     17        to always operate on the current thread.
     18        (WTF::initializeThreading): Changed to use setThreadNameInternal.
     19        (WTF::createThreadInternal): Removed call to setThreadName. This is
     20        now handled by threadEntryPoint and setThreadNameInternal.
     21
    1222009-03-11  David Kilzer  <[email protected]>
    223
  • trunk/JavaScriptCore/wtf/Threading.cpp

    r41605 r41626  
    6565ThreadIdentifier createThread(ThreadFunction entryPoint, void* data, const char* name)
    6666{
     67    // Visual Studio has a 31-character limit on thread names. Longer names will
     68    // be truncated silently, but we'd like callers to know about the limit.
     69#if !LOG_DISABLED
     70    if (strlen(name) > 31)
     71        LOG_ERROR("Thread name \"%s\" is longer than 31 characters and will be truncated by Visual Studio", name);
     72#endif
     73
    6774    NewThreadContext* context = new NewThreadContext(entryPoint, data, name);
    6875
  • trunk/JavaScriptCore/wtf/ThreadingWin.cpp

    r41605 r41626  
    9999namespace WTF {
    100100
    101 // MS_VC_EXCEPTION, THREADNAME_INFO, and setThreadName all come from <http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx>.
     101// MS_VC_EXCEPTION, THREADNAME_INFO, and setThreadNameInternal all come from <http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx>.
    102102static const DWORD MS_VC_EXCEPTION = 0x406D1388;
    103103
     
    111111#pragma pack(pop)
    112112
    113 static void setThreadName(DWORD dwThreadID, LPCSTR szThreadName)
    114 {
    115     // Visual Studio has a 31-character limit on thread names. Longer names will
    116     // be truncated silently, but we'd like callers to know about the limit.
    117     ASSERT_ARG(szThreadName, strlen(szThreadName) <= 31);
    118 
     113void setThreadNameInternal(const char* szThreadName)
     114{
    119115    THREADNAME_INFO info;
    120116    info.dwType = 0x1000;
    121117    info.szName = szThreadName;
    122     info.dwThreadID = dwThreadID;
     118    info.dwThreadID = GetCurrentThreadId();
    123119    info.dwFlags = 0;
    124120
     
    158154        initializeMainThread();
    159155        mainThreadIdentifier = currentThread();
    160         setThreadName(mainThreadIdentifier, "Main Thread");
     156        setThreadNameInternal("Main Thread");
    161157    }
    162158}
     
    221217    }
    222218
    223     if (threadName)
    224         setThreadName(threadIdentifier, threadName);
    225 
    226219    threadID = static_cast<ThreadIdentifier>(threadIdentifier);
    227220    storeThreadHandleByIdentifier(threadIdentifier, threadHandle);
    228221
    229222    return threadID;
    230 }
    231 
    232 void setThreadNameInternal(const char*)
    233 {
    234223}
    235224
Note: See TracChangeset for help on using the changeset viewer.