aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/alarm.h
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2016-02-11 03:30:10 -0800
committerGravatar Vijay Pai <vpai@google.com>2016-02-11 03:30:10 -0800
commit810a13e2d3fef85c706ef5c80dd12bb864a2ab6b (patch)
tree2cd17595f006802478d3c66d2e5f4be0c3eb1b72 /include/grpc++/alarm.h
parent29e1d95a21daca20f3e886cde037e61d7500327e (diff)
Remove a small allocation, at the cost of a little uglier header file.
This commit may or may not be a great tradeoff.
Diffstat (limited to 'include/grpc++/alarm.h')
-rw-r--r--include/grpc++/alarm.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/grpc++/alarm.h b/include/grpc++/alarm.h
index f0ab546cb2..9979c34e4f 100644
--- a/include/grpc++/alarm.h
+++ b/include/grpc++/alarm.h
@@ -36,6 +36,7 @@
#ifndef GRPCXX_ALARM_H
#define GRPCXX_ALARM_H
+#include <grpc++/impl/codegen/completion_queue_tag.h>
#include <grpc++/impl/codegen/grpc_library.h>
#include <grpc++/impl/codegen/time.h>
@@ -63,6 +64,19 @@ class Alarm : private GrpcLibrary {
void Cancel();
private:
+ class AlarmEntry : public CompletionQueueTag {
+ public:
+ AlarmEntry(void* tag) : tag_(tag) {}
+ bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE {
+ *tag = tag_;
+ return true;
+ }
+
+ private:
+ void* tag_;
+ };
+
+ AlarmEntry tag_;
grpc_alarm* const alarm_; // owned
};