Changeset 55429 in webkit for trunk/JavaScriptCore/wtf/ThreadingPthreads.cpp
- Timestamp:
- Mar 2, 2010, 2:21:37 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/ThreadingPthreads.cpp
r55247 r55429 54 54 namespace WTF { 55 55 56 typedef struct { 57 pthread_t handle; 58 void* context; 59 } ThreadInfo; 60 61 typedef HashMap<ThreadIdentifier, ThreadInfo> ThreadMap; 56 typedef HashMap<ThreadIdentifier, pthread_t> ThreadMap; 62 57 63 58 static Mutex* atomicallyInitializedStaticMutex; … … 111 106 ThreadMap::iterator i = threadMap().begin(); 112 107 for (; i != threadMap().end(); ++i) { 113 if (pthread_equal(i->second .handle, pthreadHandle))108 if (pthread_equal(i->second, pthreadHandle)) 114 109 return i->first; 115 110 } … … 118 113 } 119 114 120 static ThreadIdentifier establishIdentifierForPthreadHandle(const pthread_t& pthreadHandle , void* context)115 static ThreadIdentifier establishIdentifierForPthreadHandle(const pthread_t& pthreadHandle) 121 116 { 122 117 ASSERT(!identifierByPthreadHandle(pthreadHandle)); … … 126 121 static ThreadIdentifier identifierCount = 1; 127 122 128 ThreadInfo info; 129 info.handle = pthreadHandle; 130 info.context = context; 131 threadMap().add(identifierCount, info); 123 threadMap().add(identifierCount, pthreadHandle); 132 124 133 125 return identifierCount++; … … 138 130 MutexLocker locker(threadMapMutex()); 139 131 140 return threadMap().get(id).handle; 141 } 142 143 static void* contextForIdentifier(ThreadIdentifier id) 144 { 145 MutexLocker locker(threadMapMutex()); 146 147 return threadMap().get(id).context; 148 } 149 132 return threadMap().get(id); 133 } 150 134 151 135 void clearPthreadHandleForIdentifier(ThreadIdentifier id) … … 191 175 return 0; 192 176 } 193 return establishIdentifierForPthreadHandle(threadHandle , data);177 return establishIdentifierForPthreadHandle(threadHandle); 194 178 } 195 179 #else … … 202 186 } 203 187 204 return establishIdentifierForPthreadHandle(threadHandle , data);188 return establishIdentifierForPthreadHandle(threadHandle); 205 189 } 206 190 #endif … … 252 236 253 237 // Not a WTF-created thread, ThreadIdentifier is not established yet. 254 id = establishIdentifierForPthreadHandle(pthread_self() , 0);238 id = establishIdentifierForPthreadHandle(pthread_self()); 255 239 ThreadIdentifierData::initialize(id); 256 240 return id; … … 266 250 } 267 251 268 void* threadContext(ThreadIdentifier id)269 {270 return contextForIdentifier(id);271 }272 273 252 Mutex::Mutex() 274 253 {
Note:
See TracChangeset
for help on using the changeset viewer.