diff options
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. |