Changeset 96722 in webkit for trunk/Source/JavaScriptCore/heap
- Timestamp:
- Oct 5, 2011, 10:44:26 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/MachineStackMarker.cpp
r95922 r96722 112 112 class MachineThreads::Thread { 113 113 public: 114 Thread(pthread_t pthread, const PlatformThread& platThread, void* base) 115 : posixThread(pthread) 116 , platformThread(platThread) 114 Thread(const PlatformThread& platThread, void* base) 115 : platformThread(platThread) 117 116 , stackBase(base) 118 117 { … … 133 132 134 133 Thread* next; 135 pthread_t posixThread;136 134 PlatformThread platformThread; 137 135 void* stackBase; … … 165 163 return pthread_mach_thread_np(pthread_self()); 166 164 #elif OS(WINDOWS) 167 return pthread_getw32threadhandle_np(pthread_self());165 return GetCurrentThread(); 168 166 #elif USE(PTHREADS) 169 167 return pthread_self(); 168 #endif 169 } 170 171 static inline bool equalThread(const PlatformThread& first, const PlatformThread& second) 172 { 173 #if OS(DARWIN) || OS(WINDOWS) 174 return first == second; 175 #elif USE(PTHREADS) 176 return !!pthread_equal(first, second); 177 #else 178 #error Need a way to compare threads on this platform 170 179 #endif 171 180 } … … 189 198 190 199 pthread_setspecific(m_threadSpecific, this); 191 Thread* thread = new Thread( pthread_self(),getCurrentPlatformThread(), m_heap->globalData()->stack().origin());200 Thread* thread = new Thread(getCurrentPlatformThread(), m_heap->globalData()->stack().origin()); 192 201 193 202 MutexLocker lock(m_registeredThreadsMutex); … … 205 214 void MachineThreads::removeCurrentThread() 206 215 { 207 pthread_t currentPosixThread = pthread_self();216 PlatformThread currentPlatformThread = getCurrentPlatformThread(); 208 217 209 218 MutexLocker lock(m_registeredThreadsMutex); 210 219 211 if ( pthread_equal(currentPosixThread, m_registeredThreads->posixThread)) {220 if (equalThread(currentPlatformThread, m_registeredThreads->platformThread)) { 212 221 Thread* t = m_registeredThreads; 213 222 m_registeredThreads = m_registeredThreads->next; … … 217 226 Thread* t; 218 227 for (t = m_registeredThreads->next; t; t = t->next) { 219 if ( pthread_equal(t->posixThread, currentPosixThread)) {228 if (equalThread(t->platformThread, currentPlatformThread)) { 220 229 last->next = t->next; 221 230 break; … … 468 477 469 478 if (m_threadSpecific) { 479 PlatformThread currentPlatformThread = getCurrentPlatformThread(); 470 480 471 481 MutexLocker lock(m_registeredThreadsMutex); … … 480 490 // and since this is a shared heap, they are real locks. 481 491 for (Thread* thread = m_registeredThreads; thread; thread = thread->next) { 482 if (! pthread_equal(thread->posixThread, pthread_self()))492 if (!equalThread(thread->platformThread, currentPlatformThread)) 483 493 gatherFromOtherThread(conservativeRoots, thread); 484 494 }
Note:
See TracChangeset
for help on using the changeset viewer.