Ignore:
Timestamp:
Mar 11, 2009, 6:26:55 PM (16 years ago)
Author:
Darin Adler
Message:

2009-03-11 Darin Adler <Darin Adler>

Reviewed by Mark Rowe.

Give threads names on platforms with pthread_setname_np.

  • wtf/Threading.cpp: (WTF::NewThreadContext::NewThreadContext): Initialize thread name. (WTF::threadEntryPoint): Call setThreadNameInternal. (WTF::createThread): Pass thread name.
  • wtf/Threading.h: Added new comments, setThreadNameInternal.
  • wtf/ThreadingGtk.cpp: (WTF::setThreadNameInternal): Added. Empty.
  • wtf/ThreadingNone.cpp: (WTF::setThreadNameInternal): Added. Empty.
  • wtf/ThreadingPthreads.cpp: (WTF::setThreadNameInternal): Call pthread_setname_np when available.
  • wtf/ThreadingQt.cpp: (WTF::setThreadNameInternal): Added. Empty.
  • wtf/ThreadingWin.cpp: (WTF::setThreadNameInternal): Added. Empty.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/ThreadingPthreads.cpp

    r40811 r41605  
    11/*
    2  * Copyright (C) 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
    33 * Copyright (C) 2007 Justin Haygood ([email protected])
    44 *
     
    2727 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828 */
     29
    2930#include "config.h"
    3031#include "Threading.h"
    31 
    32 #include "StdLibExtras.h"
    3332
    3433#if USE(PTHREADS)
     
    3837#include "MainThread.h"
    3938#include "RandomNumberSeed.h"
    40 
     39#include "StdLibExtras.h"
     40#include "UnusedParam.h"
    4141#include <errno.h>
    4242#include <limits.h>
     
    134134{
    135135    pthread_t threadHandle;
    136     if (pthread_create(&threadHandle, NULL, entryPoint, data)) {
     136    if (pthread_create(&threadHandle, 0, entryPoint, data)) {
    137137        LOG_ERROR("Failed to create pthread at entry point %p with data %p", entryPoint, data);
    138138        return 0;
     
    140140
    141141    return establishIdentifierForPthreadHandle(threadHandle);
     142}
     143
     144void setThreadNameInternal(const char* threadName)
     145{
     146#if PLATFORM(DARWIN) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
     147    pthread_setname_np(threadName);
     148#else
     149    UNUSED_PARAM(threadName);
     150#endif
    142151}
    143152
Note: See TracChangeset for help on using the changeset viewer.