| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 } | 1531 } |
| 1532 | 1532 |
| 1533 ~Win32Semaphore() { | 1533 ~Win32Semaphore() { |
| 1534 CloseHandle(sem); | 1534 CloseHandle(sem); |
| 1535 } | 1535 } |
| 1536 | 1536 |
| 1537 void Wait() { | 1537 void Wait() { |
| 1538 WaitForSingleObject(sem, INFINITE); | 1538 WaitForSingleObject(sem, INFINITE); |
| 1539 } | 1539 } |
| 1540 | 1540 |
| 1541 bool Wait(int timeout) { |
| 1542 // Timeout in Windows API is in milliseconds. |
| 1543 DWORD millis_timeout = timeout / 1000; |
| 1544 return WaitForSingleObject(sem, millis_timeout) != WAIT_TIMEOUT; |
| 1545 } |
| 1546 |
| 1541 void Signal() { | 1547 void Signal() { |
| 1542 LONG dummy; | 1548 LONG dummy; |
| 1543 ReleaseSemaphore(sem, 1, &dummy); | 1549 ReleaseSemaphore(sem, 1, &dummy); |
| 1544 } | 1550 } |
| 1545 | 1551 |
| 1546 private: | 1552 private: |
| 1547 HANDLE sem; | 1553 HANDLE sem; |
| 1548 }; | 1554 }; |
| 1549 | 1555 |
| 1550 | 1556 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1823 | 1829 |
| 1824 // Release the thread handles | 1830 // Release the thread handles |
| 1825 CloseHandle(data_->sampler_thread_); | 1831 CloseHandle(data_->sampler_thread_); |
| 1826 CloseHandle(data_->profiled_thread_); | 1832 CloseHandle(data_->profiled_thread_); |
| 1827 } | 1833 } |
| 1828 | 1834 |
| 1829 | 1835 |
| 1830 #endif // ENABLE_LOGGING_AND_PROFILING | 1836 #endif // ENABLE_LOGGING_AND_PROFILING |
| 1831 | 1837 |
| 1832 } } // namespace v8::internal | 1838 } } // namespace v8::internal |
| OLD | NEW |