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

Unified Diff: util/synchronization/semaphore.h

Issue 909263002: Add Semaphore::TimedWait() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | util/synchronization/semaphore.cc » ('j') | util/synchronization/semaphore_posix.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/synchronization/semaphore.h
diff --git a/util/synchronization/semaphore.h b/util/synchronization/semaphore.h
index 8cff205da8682476c32dc7994def7f5bb490d956..ac77cb7cbdf852b91ec5fa61fd9adef56e5d3893 100644
--- a/util/synchronization/semaphore.h
+++ b/util/synchronization/semaphore.h
@@ -44,8 +44,21 @@ class Semaphore {
//! Atomically decrements the value of the semaphore by 1. If the new value is
//! negative, this function blocks and will not return until the semaphore’s
//! value is incremented to 0 by Signal().
+ //!
+ //! \sa TimedWait()
void Wait();
+ //! \brief Performs a timed wait (or “procure”) operation on the semaphore.
+ //!
+ //! \param[in] seconds The maximum number of seconds to wait for the operation
+ //! to complete.
+ //!
+ //! \return `false` if the wait timed out, `true` otherwise.
+ //!
+ //! This method is simlar to Wait(), except that the amount of time that it
+ //! blocks is limited.
+ bool TimedWait(double seconds);
+
//! \brief Performs the signal (or “post”) operation on the semaphore.
//!
//! Atomically increments the value of the semaphore by 1. If the new value is
« no previous file with comments | « no previous file | util/synchronization/semaphore.cc » ('j') | util/synchronization/semaphore_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698