diff options
author | vjpai <vpai@google.com> | 2016-02-10 23:16:55 -0800 |
---|---|---|
committer | vjpai <vpai@google.com> | 2016-02-10 23:16:55 -0800 |
commit | 8fdafede063a253e104f91c63c5c1599624fbe93 (patch) | |
tree | d85ad39d27fde76e95db442fa6bd580dbc988a3c /src | |
parent | f9f61cf5bca0063b417f7c6538868c41ebdddce4 (diff) |
tag fed in by user should be any arbitrary tag, not a CompletionQueueTag
type
Diffstat (limited to 'src')
-rw-r--r-- | src/cpp/common/alarm.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/cpp/common/alarm.cc b/src/cpp/common/alarm.cc index 807a67df24..6198505179 100644 --- a/src/cpp/common/alarm.cc +++ b/src/cpp/common/alarm.cc @@ -32,14 +32,28 @@ #include <grpc++/alarm.h> #include <grpc++/completion_queue.h> +#include <grpc++/impl/codegen/completion_queue_tag.h> #include <grpc++/impl/grpc_library.h> #include <grpc/grpc.h> namespace grpc { +class AlarmEntry : public CompletionQueueTag { +public: + AlarmEntry(void *tag): tag_(tag) {} + bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { + *tag = tag_; + delete this; + return true; + } +private: + void* tag_; +}; + static internal::GrpcLibraryInitializer g_gli_initializer; Alarm::Alarm(CompletionQueue* cq, gpr_timespec deadline, void* tag) - : alarm_(grpc_alarm_create(cq->cq(), deadline, tag)) { + : alarm_(grpc_alarm_create(cq->cq(), deadline, + static_cast<void*>(new AlarmEntry(tag)))) { g_gli_initializer.summon(); } |