mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Signed-off-by: Alexey Polyudov <apolyudov@google.com> Change-Id: I0023ac6e40456fc4a8169c3173bcbff3b5ccc476
30 lines
801 B
C++
30 lines
801 B
C++
#ifndef PLATFORM_API2_COUNT_DOWN_LATCH_H_
|
|
#define PLATFORM_API2_COUNT_DOWN_LATCH_H_
|
|
|
|
#include <cstdint>
|
|
|
|
#include "platform/exception.h"
|
|
#include "absl/time/time.h"
|
|
|
|
namespace location {
|
|
namespace nearby {
|
|
|
|
// A synchronization aid that allows one or more threads to wait until a set of
|
|
// operations being performed in other threads completes.
|
|
//
|
|
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CountDownLatch.html
|
|
class CountDownLatch {
|
|
public:
|
|
virtual ~CountDownLatch() {}
|
|
|
|
virtual Exception Await() = 0; // throws Exception::kInterrupted
|
|
virtual ExceptionOr<bool> Await(
|
|
absl::Duration timeout) = 0; // throws Exception::kInterrupted
|
|
virtual void CountDown() = 0;
|
|
};
|
|
|
|
} // namespace nearby
|
|
} // namespace location
|
|
|
|
#endif // PLATFORM_API2_COUNT_DOWN_LATCH_H_
|