diff options
author | Sree Kuchibhotla <sreek@google.com> | 2017-02-17 09:28:46 -0800 |
---|---|---|
committer | Sree Kuchibhotla <sreek@google.com> | 2017-03-02 12:50:46 -0800 |
commit | 7a4e5b427ccfdef78a170c9e9ba7f04e1f59b0fe (patch) | |
tree | ee9bd8edfe3271575b68deab72b060074a2a473e /include | |
parent | a35d0e3864cef3136b24cb65cbdb9c2424c421da (diff) |
Completion queue creation API change (JUST API change. No functionality change)
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc/grpc.h | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 1b33d48c02..5874710bd4 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -93,9 +93,51 @@ GRPCAPI const char *grpc_version_string(void); /** Return a string specifying what the 'g' in gRPC stands for */ GRPCAPI const char *grpc_g_stands_for(void); -/** Create a completion queue */ +/** Specifies the type of APIs to use to pop events from the completion queue */ +typedef enum { + /** Events are popped out by calling grpc_completion_queue_next() API ONLY */ + GRPC_CQ_NEXT = 1, + /** Events are popped out by calling grpc_completion_queue_pluck() API ONLY*/ + GRPC_CQ_PLUCK +} grpc_cq_completion_type; + +/** Completion queues internally MAY maintain a set of file descriptors in a + structure called 'pollset'. This enum specifies if a completion queue has an + associated pollset and any restrictions on the type of file descriptors that + can be present in the pollset. + + I/O progress can only be made when grpc_completion_queue_next() or + grpc_completion_queue_pluck() are called on the completion queue (unless the + grpc_cq_polling_type is NON_POLLING) and hence it is very important to + actively call these APIs */ +typedef enum { + /** The completion queue will have an associated pollset and there is no + restriction on the type of file descriptors the pollset may contain */ + DEFAULT_POLLING, + + /** Similar to DEFAULT_POLLING except that the completion queues will not + contain any 'listening file descriptors' (i.e file descriptors used to + listen to incoming channels */ + NON_LISTENING, + + /** The completion queue will not have an associated pollset. Note that + grpc_completion_queue_next() or grpc_completion_queue_pluck() MUST still + be called to pop events from the completion queue; it is not required to + call them actively to make I/O progress */ + NON_POLLING +} grpc_cq_polling_type; + +/** Create a completion queue. + + WARNING: This API is deprecated and will soon be deleted and replaced with + completion_queue_create_ex() */ GRPCAPI grpc_completion_queue *grpc_completion_queue_create(void *reserved); +/** Create a completion queue */ +GRPCAPI grpc_completion_queue *grpc_completion_queue_create_ex( + grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type, + void *reserved); + /** Blocks until an event is available, the completion queue is being shut down, or deadline is reached. |