diff options
author | Vijay Pai <vpai@google.com> | 2015-03-11 15:52:43 -0700 |
---|---|---|
committer | Vijay Pai <vpai@google.com> | 2015-03-11 15:52:43 -0700 |
commit | ee705f6d6681fb22e0b364999763cf84a2cb1197 (patch) | |
tree | 7c6e658372549331490b7ef66b277fca159d997e /include/grpc++/completion_queue.h | |
parent | ea8d8dedc6ad27a283b2bf25c39de0d93f04fb39 (diff) |
Add support for deadline on CompletionQueue::Next
If the deadline elapses, return true but have a null tag.
Diffstat (limited to 'include/grpc++/completion_queue.h')
-rw-r--r-- | include/grpc++/completion_queue.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index f741e3c36b..db6e6d41f3 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -34,6 +34,7 @@ #ifndef GRPCXX_COMPLETION_QUEUE_H #define GRPCXX_COMPLETION_QUEUE_H +#include <grpc/support/time.h> #include <grpc++/impl/client_unary_call.h> struct grpc_completion_queue; @@ -75,10 +76,10 @@ class CompletionQueue { explicit CompletionQueue(grpc_completion_queue *take); ~CompletionQueue(); - // Blocking read from queue. - // Returns true if an event was received, false if the queue is ready - // for destruction. - bool Next(void **tag, bool *ok); + // Blocking (until deadline) read from queue. + // Returns false if the queue is ready for destruction, true otherwise + // If the deadline passed, *tag will be null + bool Next(void **tag, bool *ok, gpr_timespec deadline=gpr_inf_future); // Shutdown has to be called, and the CompletionQueue can only be // destructed when false is returned from Next(). |