Make grpc_exec_ctx_flush return a status indicating if work was performed

pull/3467/head
Craig Tiller 10 years ago
parent 084c8089a4
commit 4086474399
  1. 5
      src/core/iomgr/exec_ctx.c
  2. 5
      src/core/iomgr/exec_ctx.h

@ -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) {

@ -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);

Loading…
Cancel
Save