diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-11-19 12:40:24 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-11-20 21:53:15 +0000 |
commit | 64b7c822099d7cda921699e380c4d95608a1ab00 (patch) | |
tree | aba34f4fd95ecc0d20f176f177550a3f369486e4 /vespalib | |
parent | 05377eb166b3d310774545fdd35172991dba9390 (diff) |
milliseconds in config.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/sync.h | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/vespalib/src/vespa/vespalib/util/sync.h b/vespalib/src/vespa/vespalib/util/sync.h index 6461eaf9c3f..12961dffef7 100644 --- a/vespalib/src/vespa/vespalib/util/sync.h +++ b/vespalib/src/vespa/vespalib/util/sync.h @@ -376,7 +376,10 @@ public: * @return true if a signal was received, false if the wait timed out. **/ bool wait(int msTimeout) { - return _cond->wait_for(_guard, std::chrono::milliseconds(msTimeout)) == std::cv_status::no_timeout; + return wait(std::chrono::milliseconds(msTimeout)); + } + bool wait(std::chrono::milliseconds timeout) { + return _cond->wait_for(_guard, timeout) == std::cv_status::no_timeout; } /** * @brief Send a signal to a single waiter on the underlying @@ -404,19 +407,7 @@ public: _cond->notify_one(); _cond = nullptr; } - /** - * @brief Send a signal to all waiters on the underlying Monitor, - * but unlock the monitor right before doing so. - * - * This is inherently unsafe and the caller needs external - * synchronization to ensure that the underlying Monitor object - * will live long enough to be signaled. - **/ - void unsafeBroadcastUnlock() { - _guard.unlock(); - _cond->notify_all(); - _cond = nullptr; - } + /** * @brief Release the lock held by this object if unlock has not * been called. |