|
|
|
@ -36,7 +36,6 @@ |
|
|
|
|
|
|
|
|
|
#include <grpc/grpc.h> |
|
|
|
|
#include <grpc/support/log.h> |
|
|
|
|
#include <grpc/support/time.h> |
|
|
|
|
#include "src/cpp/util/time.h" |
|
|
|
|
|
|
|
|
|
namespace grpc { |
|
|
|
@ -57,15 +56,12 @@ class EventDeleter { |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
CompletionQueue::NextStatus |
|
|
|
|
CompletionQueue::AsyncNext(void** tag, bool* ok, |
|
|
|
|
std::chrono::system_clock::time_point deadline) { |
|
|
|
|
CompletionQueue::NextStatus CompletionQueue::AsyncNextInternal( |
|
|
|
|
void** tag, bool* ok, gpr_timespec deadline) { |
|
|
|
|
std::unique_ptr<grpc_event, EventDeleter> ev; |
|
|
|
|
|
|
|
|
|
gpr_timespec gpr_deadline; |
|
|
|
|
Timepoint2Timespec(deadline, &gpr_deadline); |
|
|
|
|
for (;;) { |
|
|
|
|
ev.reset(grpc_completion_queue_next(cq_, gpr_deadline)); |
|
|
|
|
ev.reset(grpc_completion_queue_next(cq_, deadline)); |
|
|
|
|
if (!ev) { /* got a NULL back because deadline passed */ |
|
|
|
|
return TIMEOUT; |
|
|
|
|
} |
|
|
|
@ -81,6 +77,13 @@ CompletionQueue::AsyncNext(void** tag, bool* ok, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
CompletionQueue::NextStatus CompletionQueue::AsyncNext( |
|
|
|
|
void** tag, bool* ok, std::chrono::system_clock::time_point deadline) { |
|
|
|
|
gpr_timespec gpr_deadline; |
|
|
|
|
Timepoint2Timespec(deadline, &gpr_deadline); |
|
|
|
|
return AsyncNextInternal(tag, ok, gpr_deadline); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool CompletionQueue::Pluck(CompletionQueueTag* tag) { |
|
|
|
|
std::unique_ptr<grpc_event, EventDeleter> ev; |
|
|
|
|
|
|
|
|
|