diff options
author | David Garcia Quintas <dgq@google.com> | 2016-02-17 17:10:41 -0800 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2016-02-17 17:10:41 -0800 |
commit | 5e07d76a86c42e4e4e5d103b7579e364339af4d0 (patch) | |
tree | b90e579b37614bd56b5a91d8ac442b95108a91b2 /include/grpc++/alarm.h | |
parent | 7da3297be7068a5a167991efafb2ec4eba2b2779 (diff) |
Made Alarm's constructor a template for deadline
Diffstat (limited to 'include/grpc++/alarm.h')
-rw-r--r-- | include/grpc++/alarm.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/grpc++/alarm.h b/include/grpc++/alarm.h index 9979c34e4f..66904deb48 100644 --- a/include/grpc++/alarm.h +++ b/include/grpc++/alarm.h @@ -39,6 +39,8 @@ #include <grpc++/impl/codegen/completion_queue_tag.h> #include <grpc++/impl/codegen/grpc_library.h> #include <grpc++/impl/codegen/time.h> +#include <grpc++/impl/codegen/completion_queue.h> +#include <grpc/grpc.h> struct grpc_alarm; @@ -54,7 +56,11 @@ class Alarm : private GrpcLibrary { /// Once the alarm expires (at \a deadline) or it's cancelled (see \a Cancel), /// an event with tag \a tag will be added to \a cq. If the alarm expired, the /// event's success bit will be true, false otherwise (ie, upon cancellation). - Alarm(CompletionQueue* cq, gpr_timespec deadline, void* tag); + template <typename T> + Alarm(CompletionQueue* cq, const T& deadline, void* tag) + : tag_(tag), + alarm_(grpc_alarm_create(cq->cq(), TimePoint<T>(deadline).raw_time(), + static_cast<void*>(&tag_))) {} /// Destroy the given completion queue alarm, cancelling it in the process. ~Alarm(); |