Skip to content
Snippets Groups Projects
Commit 40945c70 authored by Craig Tiller's avatar Craig Tiller
Browse files

Add missing function for completion queue

parent 9f9d4223
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment