Changeset 41605 in webkit for trunk/JavaScriptCore
- Timestamp:
- Mar 11, 2009, 6:26:55 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r41594 r41605 1 2009-03-11 Darin Adler <[email protected]> 2 3 Reviewed by Mark Rowe. 4 5 Give threads names on platforms with pthread_setname_np. 6 7 * wtf/Threading.cpp: 8 (WTF::NewThreadContext::NewThreadContext): Initialize thread name. 9 (WTF::threadEntryPoint): Call setThreadNameInternal. 10 (WTF::createThread): Pass thread name. 11 12 * wtf/Threading.h: Added new comments, setThreadNameInternal. 13 14 * wtf/ThreadingGtk.cpp: 15 (WTF::setThreadNameInternal): Added. Empty. 16 * wtf/ThreadingNone.cpp: 17 (WTF::setThreadNameInternal): Added. Empty. 18 * wtf/ThreadingPthreads.cpp: 19 (WTF::setThreadNameInternal): Call pthread_setname_np when available. 20 * wtf/ThreadingQt.cpp: 21 (WTF::setThreadNameInternal): Added. Empty. 22 * wtf/ThreadingWin.cpp: 23 (WTF::setThreadNameInternal): Added. Empty. 24 1 25 2009-03-11 Adam Roben <[email protected]> 2 26 -
trunk/JavaScriptCore/wtf/Threading.cpp
r40169 r41605 1 1 /* 2 * Copyright (C) 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 31 31 struct NewThreadContext { 32 NewThreadContext(ThreadFunction entryPoint, void* data )32 NewThreadContext(ThreadFunction entryPoint, void* data, const char* name) 33 33 : entryPoint(entryPoint) 34 34 , data(data) 35 { } 35 , name(name) 36 { 37 } 36 38 37 39 ThreadFunction entryPoint; 38 40 void* data; 41 const char* name; 39 42 40 43 Mutex creationMutex; … … 44 47 { 45 48 NewThreadContext* context = reinterpret_cast<NewThreadContext*>(contextData); 49 50 setThreadNameInternal(context->name); 46 51 47 52 // Block until our creating thread has completed any extra setup work … … 60 65 ThreadIdentifier createThread(ThreadFunction entryPoint, void* data, const char* name) 61 66 { 62 NewThreadContext* context = new NewThreadContext(entryPoint, data );67 NewThreadContext* context = new NewThreadContext(entryPoint, data, name); 63 68 64 69 // Prevent the thread body from executing until we've established the thread identifier -
trunk/JavaScriptCore/wtf/Threading.h
r41536 r41605 109 109 typedef void* (*ThreadFunction)(void* argument); 110 110 111 // Returns 0 if thread creation failed 111 // Returns 0 if thread creation failed. 112 // The thread name must be a literal since on some platforms it's passed in to the thread. 112 113 ThreadIdentifier createThread(ThreadFunction, void*, const char* threadName); 114 115 // Internal platform-specific createThread implementation. 113 116 ThreadIdentifier createThreadInternal(ThreadFunction, void*, const char* threadName); 117 118 // Called in the thread during initialization. 119 // Helpful for platforms where the thread name must be set from within the thread. 120 void setThreadNameInternal(const char* threadName); 114 121 115 122 ThreadIdentifier currentThread(); -
trunk/JavaScriptCore/wtf/ThreadingGtk.cpp
r39908 r41605 139 139 } 140 140 141 void setThreadNameInternal(const char*) 142 { 143 } 144 141 145 int waitForThreadCompletion(ThreadIdentifier threadID, void** result) 142 146 { -
trunk/JavaScriptCore/wtf/ThreadingNone.cpp
r39908 r41605 35 35 void initializeThreading() { } 36 36 ThreadIdentifier createThreadInternal(ThreadFunction, void*, const char*) { return 0; } 37 void setThreadNameInternal(const char*) { } 37 38 int waitForThreadCompletion(ThreadIdentifier, void**) { return 0; } 38 39 void detachThread(ThreadIdentifier) { } -
trunk/JavaScriptCore/wtf/ThreadingPthreads.cpp
r40811 r41605 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2007 Justin Haygood ([email protected]) 4 4 * … … 27 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 */ 29 29 30 #include "config.h" 30 31 #include "Threading.h" 31 32 #include "StdLibExtras.h"33 32 34 33 #if USE(PTHREADS) … … 38 37 #include "MainThread.h" 39 38 #include "RandomNumberSeed.h" 40 39 #include "StdLibExtras.h" 40 #include "UnusedParam.h" 41 41 #include <errno.h> 42 42 #include <limits.h> … … 134 134 { 135 135 pthread_t threadHandle; 136 if (pthread_create(&threadHandle, NULL, entryPoint, data)) {136 if (pthread_create(&threadHandle, 0, entryPoint, data)) { 137 137 LOG_ERROR("Failed to create pthread at entry point %p with data %p", entryPoint, data); 138 138 return 0; … … 140 140 141 141 return establishIdentifierForPthreadHandle(threadHandle); 142 } 143 144 void 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 142 151 } 143 152 -
trunk/JavaScriptCore/wtf/ThreadingQt.cpp
r41156 r41605 163 163 } 164 164 165 void setThreadNameInternal(const char*) 166 { 167 } 168 165 169 int waitForThreadCompletion(ThreadIdentifier threadID, void** result) 166 170 { -
trunk/JavaScriptCore/wtf/ThreadingWin.cpp
r41156 r41605 228 228 229 229 return threadID; 230 } 231 232 void setThreadNameInternal(const char*) 233 { 230 234 } 231 235
Note:
See TracChangeset
for help on using the changeset viewer.