Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Side by Side Diff: src/platform-win32.cc

Issue 48123: Added a wait with timeout to the platform semaphore class (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/platform-macos.cc ('k') | test/cctest/test-lock.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/platform-macos.cc ('k') | test/cctest/test-lock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698