Add missing function for completion queue

pull/6645/head
Craig Tiller 9 years ago
parent 9f9d4223fb
commit 40945c702a
  1. 5
      src/core/lib/surface/completion_queue.c
  2. 6
      test/core/surface/completion_queue_test.c

@ -86,6 +86,7 @@ struct grpc_completion_queue {
};
#define POLLSET_FROM_CQ(cq) ((grpc_pollset *)(cq + 1))
#define CQ_FROM_POLLSET(ps) (((grpc_completion_queue *)ps) - 1)
static gpr_mu g_freelist_mu;
static grpc_completion_queue *g_freelist;
@ -514,6 +515,10 @@ grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc) {
return POLLSET_FROM_CQ(cc);
}
grpc_completion_queue *grpc_cq_from_pollset(grpc_pollset *ps) {
return CQ_FROM_POLLSET(ps);
}
void grpc_cq_mark_non_listening_server_cq(grpc_completion_queue *cc) {
cc->is_non_listening_server_cq = 1;
}

@ -63,6 +63,12 @@ static void test_no_op(void) {
shutdown_and_destroy(grpc_completion_queue_create(NULL));
}
static void test_pollset_conversion() {
grpc_completion_queue *cq = grpc_completion_queue(NULL);
GPR_ASSERT(grpc_cq_from_pollset(grpc_cq_pollset(cq)) == cq);
shutdown_and_destroy(cq);
}
static void test_wait_empty(void) {
grpc_completion_queue *cc;
grpc_event event;

Loading…
Cancel
Save