aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc
diff options
context:
space:
mode:
Diffstat (limited to 'include/grpc')
-rw-r--r--include/grpc/grpc.h6
-rw-r--r--include/grpc/impl/codegen/grpc_types.h19
2 files changed, 23 insertions, 2 deletions
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h
index dc22008932..897b89851a 100644
--- a/include/grpc/grpc.h
+++ b/include/grpc/grpc.h
@@ -101,6 +101,12 @@ GRPCAPI grpc_completion_queue* grpc_completion_queue_create_for_next(
GRPCAPI grpc_completion_queue* grpc_completion_queue_create_for_pluck(
void* reserved);
+/** Helper function to create a completion queue with grpc_cq_completion_type
+ of GRPC_CQ_CALLBACK and grpc_cq_polling_type of GRPC_CQ_DEFAULT_POLLING.
+ This function is experimental. */
+GRPCAPI grpc_completion_queue* grpc_completion_queue_create_for_callback(
+ void* shutdown_callback, void* reserved);
+
/** Create a completion queue */
GRPCAPI grpc_completion_queue* grpc_completion_queue_create(
const grpc_completion_queue_factory* factory,
diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h
index 5fd080c48b..b5353c1dea 100644
--- a/include/grpc/impl/codegen/grpc_types.h
+++ b/include/grpc/impl/codegen/grpc_types.h
@@ -651,10 +651,16 @@ typedef enum {
GRPC_CQ_NEXT,
/** Events are popped out by calling grpc_completion_queue_pluck() API ONLY*/
- GRPC_CQ_PLUCK
+ GRPC_CQ_PLUCK,
+
+ /** EXPERIMENTAL: Events trigger a callback specified as the tag */
+ GRPC_CQ_CALLBACK
} grpc_cq_completion_type;
-#define GRPC_CQ_CURRENT_VERSION 1
+/* The upgrade to version 2 is currently experimental. */
+
+#define GRPC_CQ_CURRENT_VERSION 2
+#define GRPC_CQ_VERSION_MINIMUM_FOR_CALLBACKABLE 2
typedef struct grpc_completion_queue_attributes {
/** The version number of this structure. More fields might be added to this
structure in future. */
@@ -663,6 +669,15 @@ typedef struct grpc_completion_queue_attributes {
grpc_cq_completion_type cq_completion_type;
grpc_cq_polling_type cq_polling_type;
+
+ /* END OF VERSION 1 CQ ATTRIBUTES */
+
+ /* EXPERIMENTAL: START OF VERSION 2 CQ ATTRIBUTES */
+ /** When creating a callbackable CQ, pass in a functor to get invoked when
+ * shutdown is complete */
+ void* cq_shutdown_cb;
+
+ /* END OF VERSION 2 CQ ATTRIBUTES */
} grpc_completion_queue_attributes;
/** The completion queue factory structure is opaque to the callers of grpc */