diff options
author | 2014-12-17 16:36:59 -0800 | |
---|---|---|
committer | 2014-12-19 13:04:38 -0800 | |
commit | d79b4865ce124d12b2394c2755df8f6539418e93 (patch) | |
tree | c3fc33e4cf7d043e7cb61fe4a526e491554aaed1 /src/core/surface/completion_queue.c | |
parent | a4b6f5df94d6293455f2fed86b56491b7f6dd39e (diff) |
Introduce the (outside-of-iomgr) pollset API.
This CL introduces the public side of this interface. There will need to be an
iomgr-private API also, but this will be a per-implementation API and so is not
covered here.
I've taken care of wiring the interface through the codebase in the manner that
I expect it will be used.
Change on 2014/12/17 by ctiller <ctiller@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=82376987
Diffstat (limited to 'src/core/surface/completion_queue.c')
-rw-r--r-- | src/core/surface/completion_queue.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/surface/completion_queue.c b/src/core/surface/completion_queue.c index b890f9dab7..4837f5b978 100644 --- a/src/core/surface/completion_queue.c +++ b/src/core/surface/completion_queue.c @@ -66,6 +66,8 @@ struct grpc_completion_queue { /* When refs drops to zero, we are in shutdown mode, and will be destroyable once all queued events are drained */ gpr_refcount refs; + /* the set of low level i/o things that concern this cq */ + grpc_pollset pollset; /* 0 initially, 1 once we've begun shutting down */ int shutdown; /* Head of a linked list of queued events (prev points to the last element) */ @@ -87,6 +89,7 @@ grpc_completion_queue *grpc_completion_queue_create() { memset(cc, 0, sizeof(*cc)); /* Initial ref is dropped by grpc_completion_queue_shutdown */ gpr_ref_init(&cc->refs, 1); + grpc_pollset_init(&cc->pollset); cc->allow_polling = 1; return cc; } @@ -367,6 +370,7 @@ void grpc_completion_queue_shutdown(grpc_completion_queue *cc) { void grpc_completion_queue_destroy(grpc_completion_queue *cc) { GPR_ASSERT(cc->queue == NULL); + grpc_pollset_destroy(&cc->pollset); gpr_free(cc); } @@ -392,3 +396,7 @@ void grpc_cq_dump_pending_ops(grpc_completion_queue *cc) { gpr_log(GPR_INFO, "pending ops:%s", tmp); #endif } + +grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc) { + return &cc->pollset; +} |