Changeset 108119 in webkit for trunk/Source/JavaScriptCore/wtf/ThreadingPthreads.cpp
- Timestamp:
- Feb 17, 2012, 1:54:55 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/wtf/ThreadingPthreads.cpp
r101041 r108119 41 41 #include "RandomNumberSeed.h" 42 42 #include "StdLibExtras.h" 43 #include "ThreadFunctionInvocation.h" 43 44 #include "ThreadIdentifierDataPthreads.h" 44 45 #include "ThreadSpecific.h" 45 46 #include "UnusedParam.h" 47 #include <wtf/OwnPtr.h> 48 #include <wtf/PassOwnPtr.h> 46 49 #include <wtf/WTFThreadData.h> 47 50 #include <errno.h> … … 153 156 } 154 157 158 static void* wtfThreadEntryPoint(void* param) 159 { 160 // Balanced by .leakPtr() in createThreadInternal. 161 OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(static_cast<ThreadFunctionInvocation*>(param)); 162 invocation->function(invocation->data); 163 164 return 0; 165 } 166 155 167 #if PLATFORM(BLACKBERRY) 156 168 ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char* threadName) … … 172 184 } 173 185 186 OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(new ThreadFunctionInvocation(entryPoint, data)); 174 187 pthread_t threadHandle; 175 if (pthread_create(&threadHandle, &attr, entryPoint, data)) {188 if (pthread_create(&threadHandle, &attr, wtfThreadEntryPoint, invocation.get())) { 176 189 LOG_ERROR("pthread_create() failed: %d", errno); 177 190 threadHandle = 0; … … 184 197 return 0; 185 198 199 // Balanced by adoptPtr() in wtfThreadEntryPoint. 200 ThreadFunctionInvocation* leakedInvocation = invocation.leakPtr(); 201 UNUSED_PARAM(leakedInvocation); 202 186 203 return establishIdentifierForPthreadHandle(threadHandle); 187 204 } … … 189 206 ThreadIdentifier createThreadInternal(ThreadFunction entryPoint, void* data, const char*) 190 207 { 208 OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(new ThreadFunctionInvocation(entryPoint, data)); 191 209 pthread_t threadHandle; 192 if (pthread_create(&threadHandle, 0, entryPoint, data)) {193 LOG_ERROR("Failed to create pthread at entry point %p with data %p", entryPoint, data);210 if (pthread_create(&threadHandle, 0, wtfThreadEntryPoint, invocation.get())) { 211 LOG_ERROR("Failed to create pthread at entry point %p with data %p", wtfThreadEntryPoint, invocation.get()); 194 212 return 0; 195 213 } 214 215 // Balanced by adoptPtr() in wtfThreadEntryPoint. 216 ThreadFunctionInvocation* leakedInvocation = invocation.leakPtr(); 217 UNUSED_PARAM(leakedInvocation); 196 218 197 219 return establishIdentifierForPthreadHandle(threadHandle); … … 218 240 } 219 241 220 int waitForThreadCompletion(ThreadIdentifier threadID , void** result)242 int waitForThreadCompletion(ThreadIdentifier threadID) 221 243 { 222 244 ASSERT(threadID); … … 226 248 return 0; 227 249 228 int joinResult = pthread_join(pthreadHandle, result);250 int joinResult = pthread_join(pthreadHandle, 0); 229 251 if (joinResult == EDEADLK) 230 252 LOG_ERROR("ThreadIdentifier %u was found to be deadlocked trying to quit", threadID);
Note:
See TracChangeset
for help on using the changeset viewer.