| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2009 Torch Mobile, Inc. All rights reserved. | 4 * Copyright (C) 2009 Torch Mobile, Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 unsigned threadIdentifier = 0; | 211 unsigned threadIdentifier = 0; |
| 212 ThreadIdentifier threadID = 0; | 212 ThreadIdentifier threadID = 0; |
| 213 OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(new ThreadFunctionInv
ocation(entryPoint, data)); | 213 OwnPtr<ThreadFunctionInvocation> invocation = adoptPtr(new ThreadFunctionInv
ocation(entryPoint, data)); |
| 214 HANDLE threadHandle = reinterpret_cast<HANDLE>(_beginthreadex(0, 0, wtfThrea
dEntryPoint, invocation.get(), 0, &threadIdentifier)); | 214 HANDLE threadHandle = reinterpret_cast<HANDLE>(_beginthreadex(0, 0, wtfThrea
dEntryPoint, invocation.get(), 0, &threadIdentifier)); |
| 215 if (!threadHandle) { | 215 if (!threadHandle) { |
| 216 WTF_LOG_ERROR("Failed to create thread at entry point %p with data %p: %
ld", entryPoint, data, errno); | 216 WTF_LOG_ERROR("Failed to create thread at entry point %p with data %p: %
ld", entryPoint, data, errno); |
| 217 return 0; | 217 return 0; |
| 218 } | 218 } |
| 219 | 219 |
| 220 // The thread will take ownership of invocation. | 220 // The thread will take ownership of invocation. |
| 221 ThreadFunctionInvocation* leakedInvocation = invocation.leakPtr(); | 221 ThreadFunctionInvocation* ALLOW_UNUSED leakedInvocation = invocation.leakPtr
(); |
| 222 UNUSED_PARAM(leakedInvocation); | |
| 223 | 222 |
| 224 threadID = static_cast<ThreadIdentifier>(threadIdentifier); | 223 threadID = static_cast<ThreadIdentifier>(threadIdentifier); |
| 225 storeThreadHandleByIdentifier(threadIdentifier, threadHandle); | 224 storeThreadHandleByIdentifier(threadIdentifier, threadHandle); |
| 226 | 225 |
| 227 return threadID; | 226 return threadID; |
| 228 } | 227 } |
| 229 | 228 |
| 230 int waitForThreadCompletion(ThreadIdentifier threadID) | 229 int waitForThreadCompletion(ThreadIdentifier threadID) |
| 231 { | 230 { |
| 232 ASSERT(threadID); | 231 ASSERT(threadID); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 // Time is too far in the future (and would overflow unsigned long) - wait f
orever. | 483 // Time is too far in the future (and would overflow unsigned long) - wait f
orever. |
| 485 if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0) | 484 if (absoluteTime - currentTime > static_cast<double>(INT_MAX) / 1000.0) |
| 486 return INFINITE; | 485 return INFINITE; |
| 487 | 486 |
| 488 return static_cast<DWORD>((absoluteTime - currentTime) * 1000.0); | 487 return static_cast<DWORD>((absoluteTime - currentTime) * 1000.0); |
| 489 } | 488 } |
| 490 | 489 |
| 491 } // namespace WTF | 490 } // namespace WTF |
| 492 | 491 |
| 493 #endif // OS(WIN) | 492 #endif // OS(WIN) |
| OLD | NEW |