aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/closure.h
diff options
context:
space:
mode:
authorGravatar Yuchen Zeng <zyc@google.com>2016-10-03 13:24:13 -0700
committerGravatar Yuchen Zeng <zyc@google.com>2016-10-03 13:24:13 -0700
commit6988838a67479d2873fb724625cec28f1b0b5639 (patch)
treedceb3aba7883ca7269ebbf8521ead56f49a5cf0f /src/core/lib/iomgr/closure.h
parentc87b77fb3d3c333f4bfc7e732410a4dae6beb4f3 (diff)
parent9070ab6610bd8cd0dbe6922a049a3b094c908bd1 (diff)
Merge remote-tracking branch 'upstream/master' into cares_buildin
Diffstat (limited to 'src/core/lib/iomgr/closure.h')
-rw-r--r--src/core/lib/iomgr/closure.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h
index 08e59a168e..c1a22b6021 100644
--- a/src/core/lib/iomgr/closure.h
+++ b/src/core/lib/iomgr/closure.h
@@ -37,6 +37,7 @@
#include <grpc/support/port_platform.h>
#include <stdbool.h>
#include "src/core/lib/iomgr/error.h"
+#include "src/core/lib/support/mpscq.h"
struct grpc_closure;
typedef struct grpc_closure grpc_closure;
@@ -60,6 +61,14 @@ typedef void (*grpc_iomgr_cb_func)(grpc_exec_ctx *exec_ctx, void *arg,
/** A closure over a grpc_iomgr_cb_func. */
struct grpc_closure {
+ /** Once queued, next indicates the next queued closure; before then, scratch
+ * space */
+ union {
+ grpc_closure *next;
+ gpr_mpscq_node atm_next;
+ uintptr_t scratch;
+ } next_data;
+
/** Bound callback. */
grpc_iomgr_cb_func cb;
@@ -68,13 +77,6 @@ struct grpc_closure {
/** Once queued, the result of the closure. Before then: scratch space */
grpc_error *error;
-
- /** Once queued, next indicates the next queued closure; before then, scratch
- * space */
- union {
- grpc_closure *next;
- uintptr_t scratch;
- } next_data;
};
/** Initializes \a closure with \a cb and \a cb_arg. */
@@ -87,6 +89,8 @@ grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg);
#define GRPC_CLOSURE_LIST_INIT \
{ NULL, NULL }
+void grpc_closure_list_init(grpc_closure_list *list);
+
/** add \a closure to the end of \a list
and set \a closure's result to \a error */
void grpc_closure_list_append(grpc_closure_list *list, grpc_closure *closure,