aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc/support
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2017-07-17 13:52:24 -0700
committerGravatar yang-g <yangg@google.com>2017-07-25 07:45:23 -0700
commit59ef64898a9aa3bbd9d0526c360315a77b662474 (patch)
tree83e94f1980ef4acbec33b5422252deb333d147a4 /include/grpc/support
parent2c12d506fa8113bf3c4ce5949c762a5a8d9e8ee5 (diff)
Adding exec_ctx to avl vtable functions
Diffstat (limited to 'include/grpc/support')
-rw-r--r--include/grpc/support/avl.h29
1 files changed, 18 insertions, 11 deletions
diff --git a/include/grpc/support/avl.h b/include/grpc/support/avl.h
index ed052e8222..cd029ef2a6 100644
--- a/include/grpc/support/avl.h
+++ b/include/grpc/support/avl.h
@@ -31,18 +31,23 @@ typedef struct gpr_avl_node {
long height;
} gpr_avl_node;
+/** vtable for the AVL tree
+ * The optional user_data is propagated from the top level gpr_avl_XXX API.
+ * From the same API call, multiple vtable functions may be called multiple
+ * times.
+ */
typedef struct gpr_avl_vtable {
/** destroy a key */
- void (*destroy_key)(void *key);
+ void (*destroy_key)(void *key, void *user_data);
/** copy a key, returning new value */
- void *(*copy_key)(void *key);
+ void *(*copy_key)(void *key, void *user_data);
/** compare key1, key2; return <0 if key1 < key2,
>0 if key1 > key2, 0 if key1 == key2 */
- long (*compare_keys)(void *key1, void *key2);
+ long (*compare_keys)(void *key1, void *key2, void *user_data);
/** destroy a value */
- void (*destroy_value)(void *value);
+ void (*destroy_value)(void *value, void *user_data);
/** copy a value */
- void *(*copy_value)(void *value);
+ void *(*copy_value)(void *value, void *user_data);
} gpr_avl_vtable;
/** "pointer" to an AVL tree - this is a reference
@@ -57,25 +62,27 @@ typedef struct gpr_avl {
GPRAPI gpr_avl gpr_avl_create(const gpr_avl_vtable *vtable);
/** add a reference to an existing tree - returns
the tree as a convenience */
-GPRAPI gpr_avl gpr_avl_ref(gpr_avl avl);
+GPRAPI gpr_avl gpr_avl_ref(gpr_avl avl, void *user_data);
/** remove a reference to a tree - destroying it if there
are no references left */
-GPRAPI void gpr_avl_unref(gpr_avl avl);
+GPRAPI void gpr_avl_unref(gpr_avl avl, void *user_data);
/** return a new tree with (key, value) added to avl.
implicitly unrefs avl to allow easy chaining.
if key exists in avl, the new tree's key entry updated
(i.e. a duplicate is not created) */
-GPRAPI gpr_avl gpr_avl_add(gpr_avl avl, void *key, void *value);
+GPRAPI gpr_avl gpr_avl_add(gpr_avl avl, void *key, void *value,
+ void *user_data);
/** return a new tree with key deleted
implicitly unrefs avl to allow easy chaining. */
-GPRAPI gpr_avl gpr_avl_remove(gpr_avl avl, void *key);
+GPRAPI gpr_avl gpr_avl_remove(gpr_avl avl, void *key, void *user_data);
/** lookup key, and return the associated value.
does not mutate avl.
returns NULL if key is not found. */
-GPRAPI void *gpr_avl_get(gpr_avl avl, void *key);
+GPRAPI void *gpr_avl_get(gpr_avl avl, void *key, void *user_data);
/** Return 1 if avl contains key, 0 otherwise; if it has the key, sets *value to
its value*/
-GPRAPI int gpr_avl_maybe_get(gpr_avl avl, void *key, void **value);
+GPRAPI int gpr_avl_maybe_get(gpr_avl avl, void *key, void **value,
+ void *user_data);
/** Return 1 if avl is empty, 0 otherwise */
GPRAPI int gpr_avl_is_empty(gpr_avl avl);