Changeset 53714 in webkit for trunk/JavaScriptCore/wtf/ThreadingPthreads.cpp
- Timestamp:
- Jan 22, 2010, 2:00:37 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/ThreadingPthreads.cpp
r52791 r53714 38 38 #include "RandomNumberSeed.h" 39 39 #include "StdLibExtras.h" 40 #include "ThreadIdentifierDataPthreads.h" 41 #include "ThreadSpecific.h" 40 42 #include "UnusedParam.h" 41 43 #include <errno.h> … … 109 111 } 110 112 111 static ThreadIdentifier establishIdentifierForPthreadHandle( pthread_t& pthreadHandle)113 static ThreadIdentifier establishIdentifierForPthreadHandle(const pthread_t& pthreadHandle) 112 114 { 113 115 ASSERT(!identifierByPthreadHandle(pthreadHandle)); … … 129 131 } 130 132 131 staticvoid clearPthreadHandleForIdentifier(ThreadIdentifier id)133 void clearPthreadHandleForIdentifier(ThreadIdentifier id) 132 134 { 133 135 MutexLocker locker(threadMapMutex()); … … 186 188 #endif 187 189 188 void setThreadNameInternal(const char* threadName)190 void initializeCurrentThreadInternal(const char* threadName) 189 191 { 190 192 #if HAVE(PTHREAD_SETNAME_NP) … … 193 195 UNUSED_PARAM(threadName); 194 196 #endif 197 198 ThreadIdentifier id = identifierByPthreadHandle(pthread_self()); 199 ASSERT(id); 200 ThreadIdentifierData::initialize(id); 195 201 } 196 202 … … 205 211 LOG_ERROR("ThreadIdentifier %u was found to be deadlocked trying to quit", threadID); 206 212 207 clearPthreadHandleForIdentifier(threadID);208 213 return joinResult; 209 214 } … … 216 221 217 222 pthread_detach(pthreadHandle); 218 219 clearPthreadHandleForIdentifier(threadID);220 223 } 221 224 222 225 ThreadIdentifier currentThread() 223 226 { 224 pthread_t currentThread = pthread_self();225 if ( ThreadIdentifier id = identifierByPthreadHandle(currentThread))227 ThreadIdentifier id = ThreadIdentifierData::identifier(); 228 if (id) 226 229 return id; 227 return establishIdentifierForPthreadHandle(currentThread); 230 231 // Not a WTF-created thread, ThreadIdentifier is not established yet. 232 id = establishIdentifierForPthreadHandle(pthread_self()); 233 ThreadIdentifierData::initialize(id); 234 return id; 228 235 } 229 236
Note:
See TracChangeset
for help on using the changeset viewer.