aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-09-30 08:35:31 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-09-30 08:35:31 -0700
commit4086474399be1811731fac8bb6755de730ddbc3f (patch)
treeed96ddb6f2d1479a6025fe3d674ef508fe8865d5 /src/core
parent084c8089a4ca3f9e1a5516751a9562b902926f3b (diff)
Make grpc_exec_ctx_flush return a status indicating if work was performed
Diffstat (limited to 'src/core')
-rw-r--r--src/core/iomgr/exec_ctx.c5
-rw-r--r--src/core/iomgr/exec_ctx.h5
2 files changed, 7 insertions, 3 deletions
diff --git a/src/core/iomgr/exec_ctx.c b/src/core/iomgr/exec_ctx.c
index a830a27b0b..f2914d376e 100644
--- a/src/core/iomgr/exec_ctx.c
+++ b/src/core/iomgr/exec_ctx.c
@@ -35,16 +35,19 @@
#include <grpc/support/log.h>
-void grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx) {
+int grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx) {
+ int did_something = 0;
while (!grpc_closure_list_empty(exec_ctx->closure_list)) {
grpc_closure *c = exec_ctx->closure_list.head;
exec_ctx->closure_list.head = exec_ctx->closure_list.tail = NULL;
while (c != NULL) {
grpc_closure *next = c->next;
+ did_something = 1;
c->cb(exec_ctx, c->cb_arg, c->success);
c = next;
}
}
+ return did_something;
}
void grpc_exec_ctx_finish(grpc_exec_ctx *exec_ctx) {
diff --git a/src/core/iomgr/exec_ctx.h b/src/core/iomgr/exec_ctx.h
index f99aa038c5..aa0610cbea 100644
--- a/src/core/iomgr/exec_ctx.h
+++ b/src/core/iomgr/exec_ctx.h
@@ -61,8 +61,9 @@ struct grpc_exec_ctx {
{ GRPC_CLOSURE_LIST_INIT }
/** Flush any work that has been enqueued onto this grpc_exec_ctx.
- * Caller must guarantee that no interfering locks are held. */
-void grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx);
+ * Caller must guarantee that no interfering locks are held.
+ * Returns 1 if work was performed, 0 otherwise. */
+int grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx);
/** Finish any pending work for a grpc_exec_ctx. Must be called before
* the instance is destroyed, or work may be lost. */
void grpc_exec_ctx_finish(grpc_exec_ctx *exec_ctx);