From 4b82faeb8814b5dce70dbacdff6b2069e6038dc6 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Wed, 4 Dec 2019 10:52:13 -0800 Subject: [PATCH] De-experimentalize alarm --- include/grpcpp/alarm_impl.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/grpcpp/alarm_impl.h b/include/grpcpp/alarm_impl.h index 543dcd82a4c..76d8192a556 100644 --- a/include/grpcpp/alarm_impl.h +++ b/include/grpcpp/alarm_impl.h @@ -77,6 +77,17 @@ class Alarm : private ::grpc::GrpcLibraryCodegen { /// has already fired has no effect. void Cancel(); +#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL + /// Set an alarm to invoke callback \a f. The argument to the callback + /// states whether the alarm expired at \a deadline (true) or was cancelled + /// (false) + template + void Set(const T& deadline, std::function f) { + alarm_->SetInternal(::grpc::TimePoint(deadline).raw_time(), + std::move(f)); + } +#endif + /// NOTE: class experimental_type is not part of the public API of this class /// TODO(vjpai): Move these contents to the public API of Alarm when /// they are no longer experimental