mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
nearby: snapshot of cl/317978613
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: I4bf367877a986910bb03e1c54aa972b4bcd59942
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define PLATFORM_V2_API_CONDITION_VARIABLE_H_
|
||||
|
||||
#include "platform_v2/base/exception.h"
|
||||
#include "absl/time/clock.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
@@ -15,10 +16,19 @@ class ConditionVariable {
|
||||
public:
|
||||
virtual ~ConditionVariable() {}
|
||||
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--
|
||||
// Notifies all the waiters that condition state has changed.
|
||||
virtual void Notify() = 0;
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--
|
||||
virtual Exception Wait() = 0; // throws Exception::kInterrupted
|
||||
|
||||
// Waits indefinitely for Notify to be called.
|
||||
// May return prematurely in case of interrupt, if supported by platform.
|
||||
// Returns kSuccess, or kInterrupted on interrupt.
|
||||
virtual Exception Wait() = 0;
|
||||
|
||||
// Waits while timeout has not expired for Notify to be called.
|
||||
// May return prematurely in case of interrupt, if supported by platform.
|
||||
// Returns kSuccess, or kInterrupted on interrupt.
|
||||
// If Timeout expired, and Notify was not called, returns kTimeout.
|
||||
virtual Exception Wait(absl::Duration timeout) = 0;
|
||||
};
|
||||
|
||||
} // namespace api
|
||||
|
||||
Reference in New Issue
Block a user