|
|
|
@ -355,23 +355,20 @@ static bool cq_begin_op_for_callback(grpc_completion_queue* cq, void* tag); |
|
|
|
|
// queue. The done argument is a callback that will be invoked when it is
|
|
|
|
|
// safe to free up that storage. The storage MUST NOT be freed until the
|
|
|
|
|
// done callback is invoked.
|
|
|
|
|
static void cq_end_op_for_next(grpc_completion_queue* cq, void* tag, |
|
|
|
|
grpc_error* error, |
|
|
|
|
void (*done)(void* done_arg, |
|
|
|
|
grpc_cq_completion* storage), |
|
|
|
|
void* done_arg, grpc_cq_completion* storage, bool internal = false); |
|
|
|
|
|
|
|
|
|
static void cq_end_op_for_pluck(grpc_completion_queue* cq, void* tag, |
|
|
|
|
grpc_error* error, |
|
|
|
|
void (*done)(void* done_arg, |
|
|
|
|
grpc_cq_completion* storage), |
|
|
|
|
void* done_arg, grpc_cq_completion* storage, bool internal = false); |
|
|
|
|
|
|
|
|
|
static void cq_end_op_for_callback(grpc_completion_queue* cq, void* tag, |
|
|
|
|
grpc_error* error, |
|
|
|
|
void (*done)(void* done_arg, |
|
|
|
|
grpc_cq_completion* storage), |
|
|
|
|
void* done_arg, grpc_cq_completion* storage, bool internal = false); |
|
|
|
|
static void cq_end_op_for_next( |
|
|
|
|
grpc_completion_queue* cq, void* tag, grpc_error* error, |
|
|
|
|
void (*done)(void* done_arg, grpc_cq_completion* storage), void* done_arg, |
|
|
|
|
grpc_cq_completion* storage, bool internal = false); |
|
|
|
|
|
|
|
|
|
static void cq_end_op_for_pluck( |
|
|
|
|
grpc_completion_queue* cq, void* tag, grpc_error* error, |
|
|
|
|
void (*done)(void* done_arg, grpc_cq_completion* storage), void* done_arg, |
|
|
|
|
grpc_cq_completion* storage, bool internal = false); |
|
|
|
|
|
|
|
|
|
static void cq_end_op_for_callback( |
|
|
|
|
grpc_completion_queue* cq, void* tag, grpc_error* error, |
|
|
|
|
void (*done)(void* done_arg, grpc_cq_completion* storage), void* done_arg, |
|
|
|
|
grpc_cq_completion* storage, bool internal = false); |
|
|
|
|
|
|
|
|
|
static grpc_event cq_next(grpc_completion_queue* cq, gpr_timespec deadline, |
|
|
|
|
void* reserved); |
|
|
|
@ -675,12 +672,10 @@ bool grpc_cq_begin_op(grpc_completion_queue* cq, void* tag) { |
|
|
|
|
/* Queue a GRPC_OP_COMPLETED operation to a completion queue (with a
|
|
|
|
|
* completion |
|
|
|
|
* type of GRPC_CQ_NEXT) */ |
|
|
|
|
static void cq_end_op_for_next(grpc_completion_queue* cq, void* tag, |
|
|
|
|
grpc_error* error, |
|
|
|
|
void (*done)(void* done_arg, |
|
|
|
|
grpc_cq_completion* storage), |
|
|
|
|
void* done_arg, grpc_cq_completion* storage, |
|
|
|
|
bool internal) { |
|
|
|
|
static void cq_end_op_for_next( |
|
|
|
|
grpc_completion_queue* cq, void* tag, grpc_error* error, |
|
|
|
|
void (*done)(void* done_arg, grpc_cq_completion* storage), void* done_arg, |
|
|
|
|
grpc_cq_completion* storage, bool internal) { |
|
|
|
|
GPR_TIMER_SCOPE("cq_end_op_for_next", 0); |
|
|
|
|
|
|
|
|
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace) || |
|
|
|
@ -756,12 +751,10 @@ static void cq_end_op_for_next(grpc_completion_queue* cq, void* tag, |
|
|
|
|
/* Queue a GRPC_OP_COMPLETED operation to a completion queue (with a
|
|
|
|
|
* completion |
|
|
|
|
* type of GRPC_CQ_PLUCK) */ |
|
|
|
|
static void cq_end_op_for_pluck(grpc_completion_queue* cq, void* tag, |
|
|
|
|
grpc_error* error, |
|
|
|
|
void (*done)(void* done_arg, |
|
|
|
|
grpc_cq_completion* storage), |
|
|
|
|
void* done_arg, grpc_cq_completion* storage, |
|
|
|
|
bool internal) { |
|
|
|
|
static void cq_end_op_for_pluck( |
|
|
|
|
grpc_completion_queue* cq, void* tag, grpc_error* error, |
|
|
|
|
void (*done)(void* done_arg, grpc_cq_completion* storage), void* done_arg, |
|
|
|
|
grpc_cq_completion* storage, bool internal) { |
|
|
|
|
GPR_TIMER_SCOPE("cq_end_op_for_pluck", 0); |
|
|
|
|
|
|
|
|
|
cq_pluck_data* cqd = static_cast<cq_pluck_data*> DATA_FROM_CQ(cq); |
|
|
|
@ -833,8 +826,7 @@ static void functor_callback(void* arg, grpc_error* error) { |
|
|
|
|
static void cq_end_op_for_callback( |
|
|
|
|
grpc_completion_queue* cq, void* tag, grpc_error* error, |
|
|
|
|
void (*done)(void* done_arg, grpc_cq_completion* storage), void* done_arg, |
|
|
|
|
grpc_cq_completion* storage, |
|
|
|
|
bool internal) { |
|
|
|
|
grpc_cq_completion* storage, bool internal) { |
|
|
|
|
GPR_TIMER_SCOPE("cq_end_op_for_callback", 0); |
|
|
|
|
|
|
|
|
|
cq_callback_data* cqd = static_cast<cq_callback_data*> DATA_FROM_CQ(cq); |
|
|
|
@ -866,13 +858,14 @@ static void cq_end_op_for_callback( |
|
|
|
|
|
|
|
|
|
auto* functor = static_cast<grpc_experimental_completion_queue_functor*>(tag); |
|
|
|
|
if (internal) { |
|
|
|
|
grpc_core::ApplicationCallbackExecCtx::Enqueue(functor, (error == GRPC_ERROR_NONE)); |
|
|
|
|
grpc_core::ApplicationCallbackExecCtx::Enqueue(functor, |
|
|
|
|
(error == GRPC_ERROR_NONE)); |
|
|
|
|
} else { |
|
|
|
|
GRPC_CLOSURE_SCHED( |
|
|
|
|
GRPC_CLOSURE_CREATE( |
|
|
|
|
functor_callback, functor, |
|
|
|
|
grpc_core::Executor::Scheduler(grpc_core::ExecutorJobType::SHORT)), |
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
|
GRPC_CLOSURE_CREATE( |
|
|
|
|
functor_callback, functor, |
|
|
|
|
grpc_core::Executor::Scheduler(grpc_core::ExecutorJobType::SHORT)), |
|
|
|
|
GRPC_ERROR_REF(error)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GRPC_ERROR_UNREF(error); |
|
|
|
@ -880,7 +873,8 @@ static void cq_end_op_for_callback( |
|
|
|
|
|
|
|
|
|
void grpc_cq_end_op(grpc_completion_queue* cq, void* tag, grpc_error* error, |
|
|
|
|
void (*done)(void* done_arg, grpc_cq_completion* storage), |
|
|
|
|
void* done_arg, grpc_cq_completion* storage, bool internal) { |
|
|
|
|
void* done_arg, grpc_cq_completion* storage, |
|
|
|
|
bool internal) { |
|
|
|
|
cq->vtable->end_op(cq, tag, error, done, done_arg, storage, internal); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|