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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 233 |
234 res = WaitForSingleObject(m_unblockLock, INFINITE); | 234 res = WaitForSingleObject(m_unblockLock, INFINITE); |
235 ASSERT_UNUSED(res, res == WAIT_OBJECT_0); | 235 ASSERT_UNUSED(res, res == WAIT_OBJECT_0); |
236 | 236 |
237 int signalsLeft = m_waitersToUnblock; | 237 int signalsLeft = m_waitersToUnblock; |
238 | 238 |
239 if (m_waitersToUnblock) { | 239 if (m_waitersToUnblock) { |
240 --m_waitersToUnblock; | 240 --m_waitersToUnblock; |
241 } else if (++m_waitersGone == (INT_MAX / 2)) { | 241 } else if (++m_waitersGone == (INT_MAX / 2)) { |
242 // timeout/canceled or spurious semaphore timeout or spurious wakeup | 242 // timeout/canceled or spurious semaphore timeout or spurious wakeup |
243 // occured, normalize the m_waitersGone count this may occur if many | 243 // occurred, normalize the m_waitersGone count this may occur if many |
244 // calls to wait with a timeout are made and no call to notify_* is made | 244 // calls to wait with a timeout are made and no call to notify_* is made |
245 res = WaitForSingleObject(m_blockLock, INFINITE); | 245 res = WaitForSingleObject(m_blockLock, INFINITE); |
246 ASSERT_UNUSED(res, res == WAIT_OBJECT_0); | 246 ASSERT_UNUSED(res, res == WAIT_OBJECT_0); |
247 m_waitersBlocked -= m_waitersGone; | 247 m_waitersBlocked -= m_waitersGone; |
248 res = ReleaseSemaphore(m_blockLock, 1, 0); | 248 res = ReleaseSemaphore(m_blockLock, 1, 0); |
249 ASSERT_UNUSED(res, res); | 249 ASSERT_UNUSED(res, res); |
250 m_waitersGone = 0; | 250 m_waitersGone = 0; |
251 } | 251 } |
252 | 252 |
253 res = ReleaseMutex(m_unblockLock); | 253 res = ReleaseMutex(m_unblockLock); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 404 |
405 void willCreateThread() | 405 void willCreateThread() |
406 { | 406 { |
407 s_threadCreated = true; | 407 s_threadCreated = true; |
408 } | 408 } |
409 #endif | 409 #endif |
410 | 410 |
411 } // namespace WTF | 411 } // namespace WTF |
412 | 412 |
413 #endif // OS(WIN) | 413 #endif // OS(WIN) |
OLD | NEW |