| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 m_condition.m_blockQueue = CreateSemaphore(0, 0, MaxSemaphoreCount, 0); | 325 m_condition.m_blockQueue = CreateSemaphore(0, 0, MaxSemaphoreCount, 0); |
| 326 m_condition.m_unblockLock = CreateMutex(0, 0, 0); | 326 m_condition.m_unblockLock = CreateMutex(0, 0, 0); |
| 327 | 327 |
| 328 if (!m_condition.m_blockLock || !m_condition.m_blockQueue || !m_condition.m_
unblockLock) { | 328 if (!m_condition.m_blockLock || !m_condition.m_blockQueue || !m_condition.m_
unblockLock) { |
| 329 if (m_condition.m_blockLock) | 329 if (m_condition.m_blockLock) |
| 330 CloseHandle(m_condition.m_blockLock); | 330 CloseHandle(m_condition.m_blockLock); |
| 331 if (m_condition.m_blockQueue) | 331 if (m_condition.m_blockQueue) |
| 332 CloseHandle(m_condition.m_blockQueue); | 332 CloseHandle(m_condition.m_blockQueue); |
| 333 if (m_condition.m_unblockLock) | 333 if (m_condition.m_unblockLock) |
| 334 CloseHandle(m_condition.m_unblockLock); | 334 CloseHandle(m_condition.m_unblockLock); |
| 335 |
| 336 m_condition.m_blockLock = nullptr; |
| 337 m_condition.m_blockQueue = nullptr; |
| 338 m_condition.m_unblockLock = nullptr; |
| 335 } | 339 } |
| 336 } | 340 } |
| 337 | 341 |
| 338 ThreadCondition::~ThreadCondition() | 342 ThreadCondition::~ThreadCondition() |
| 339 { | 343 { |
| 340 CloseHandle(m_condition.m_blockLock); | 344 if (m_condition.m_blockLock) |
| 341 CloseHandle(m_condition.m_blockQueue); | 345 CloseHandle(m_condition.m_blockLock); |
| 342 CloseHandle(m_condition.m_unblockLock); | 346 if (m_condition.m_blockQueue) |
| 347 CloseHandle(m_condition.m_blockQueue); |
| 348 if (m_condition.m_unblockLock) |
| 349 CloseHandle(m_condition.m_unblockLock); |
| 343 } | 350 } |
| 344 | 351 |
| 345 void ThreadCondition::wait(MutexBase& mutex) | 352 void ThreadCondition::wait(MutexBase& mutex) |
| 346 { | 353 { |
| 347 m_condition.timedWait(mutex.impl(), INFINITE); | 354 m_condition.timedWait(mutex.impl(), INFINITE); |
| 348 } | 355 } |
| 349 | 356 |
| 350 bool ThreadCondition::timedWait(MutexBase& mutex, double absoluteTime) | 357 bool ThreadCondition::timedWait(MutexBase& mutex, double absoluteTime) |
| 351 { | 358 { |
| 352 DWORD interval = absoluteTimeToWaitTimeoutInterval(absoluteTime); | 359 DWORD interval = absoluteTimeToWaitTimeoutInterval(absoluteTime); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 407 |
| 401 void willCreateThread() | 408 void willCreateThread() |
| 402 { | 409 { |
| 403 s_threadCreated = true; | 410 s_threadCreated = true; |
| 404 } | 411 } |
| 405 #endif | 412 #endif |
| 406 | 413 |
| 407 } // namespace WTF | 414 } // namespace WTF |
| 408 | 415 |
| 409 #endif // OS(WIN) | 416 #endif // OS(WIN) |
| OLD | NEW |