|
|
|
@ -227,6 +227,7 @@ struct grpc_completion_queue { |
|
|
|
|
/* TODO: sreek - This will no longer be needed. Use polling_type set */ |
|
|
|
|
int is_non_listening_server_cq; |
|
|
|
|
int num_pluckers; |
|
|
|
|
gpr_atm num_poll; |
|
|
|
|
plucker pluckers[GRPC_MAX_COMPLETION_QUEUE_PLUCKERS]; |
|
|
|
|
grpc_closure pollset_shutdown_done; |
|
|
|
|
|
|
|
|
@ -292,6 +293,7 @@ grpc_completion_queue *grpc_completion_queue_create_internal( |
|
|
|
|
cc->is_server_cq = 0; |
|
|
|
|
cc->is_non_listening_server_cq = 0; |
|
|
|
|
cc->num_pluckers = 0; |
|
|
|
|
gpr_atm_no_barrier_store(&cc->num_poll, 0); |
|
|
|
|
gpr_atm_no_barrier_store(&cc->things_queued_ever, 0); |
|
|
|
|
#ifndef NDEBUG |
|
|
|
|
cc->outstanding_tag_count = 0; |
|
|
|
@ -308,6 +310,10 @@ grpc_cq_completion_type grpc_get_cq_completion_type(grpc_completion_queue *cc) { |
|
|
|
|
return cc->completion_type; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
gpr_atm grpc_get_cq_poll_num(grpc_completion_queue *cc) { |
|
|
|
|
return gpr_atm_no_barrier_load(&cc->num_poll); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef GRPC_CQ_REF_COUNT_DEBUG |
|
|
|
|
void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason, |
|
|
|
|
const char *file, int line) { |
|
|
|
@ -592,6 +598,7 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, |
|
|
|
|
gpr_mu_lock(cc->mu); |
|
|
|
|
continue; |
|
|
|
|
} else { |
|
|
|
|
cc->num_poll++; |
|
|
|
|
grpc_error *err = cc->poller_vtable->work(&exec_ctx, POLLSET_FROM_CQ(cc), |
|
|
|
|
NULL, now, iteration_deadline); |
|
|
|
|
if (err != GRPC_ERROR_NONE) { |
|
|
|
@ -784,6 +791,7 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag, |
|
|
|
|
grpc_exec_ctx_flush(&exec_ctx); |
|
|
|
|
gpr_mu_lock(cc->mu); |
|
|
|
|
} else { |
|
|
|
|
gpr_atm_no_barrier_fetch_add(&cc->num_poll, 1); |
|
|
|
|
grpc_error *err = cc->poller_vtable->work( |
|
|
|
|
&exec_ctx, POLLSET_FROM_CQ(cc), &worker, now, iteration_deadline); |
|
|
|
|
if (err != GRPC_ERROR_NONE) { |
|
|
|
|