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