diff options
author | Craig Tiller <ctiller@google.com> | 2016-11-16 15:25:16 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-11-16 15:25:16 -0800 |
commit | 9fa2ec6de2798398b8622e1af6ff7ec3a571eb0e (patch) | |
tree | 5a2febe90444702805de185a7d4ff902a6e3302c /src/core/lib/iomgr | |
parent | c586666cbdfc5b5f2a3306892f8b4491862c5aba (diff) | |
parent | 3cf79228ffcdd5c867b4067d6f6a5743a14d3ff1 (diff) |
Merge branch 'slice_with_exec_ctx' of github.com:ctiller/grpc into slice_with_exec_ctx
Diffstat (limited to 'src/core/lib/iomgr')
-rw-r--r-- | src/core/lib/iomgr/executor.h | 2 | ||||
-rw-r--r-- | src/core/lib/iomgr/iomgr.c | 12 | ||||
-rw-r--r-- | src/core/lib/iomgr/iomgr.h | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/core/lib/iomgr/executor.h b/src/core/lib/iomgr/executor.h index da9dcd07d0..7bf8f21940 100644 --- a/src/core/lib/iomgr/executor.h +++ b/src/core/lib/iomgr/executor.h @@ -48,6 +48,6 @@ void grpc_executor_init(); void grpc_executor_push(grpc_closure *closure, grpc_error *error); /** Shutdown the executor, running all pending work as part of the call */ -void grpc_executor_shutdown(); +void grpc_executor_shutdown(grpc_exec_ctx *exec_ctx); #endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */ diff --git a/src/core/lib/iomgr/iomgr.c b/src/core/lib/iomgr/iomgr.c index 4fd83e0b22..8a233d0ba8 100644 --- a/src/core/lib/iomgr/iomgr.c +++ b/src/core/lib/iomgr/iomgr.c @@ -83,11 +83,10 @@ static void dump_objects(const char *kind) { } } -void grpc_iomgr_shutdown(void) { +void grpc_iomgr_shutdown(grpc_exec_ctx *exec_ctx) { gpr_timespec shutdown_deadline = gpr_time_add( gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_seconds(10, GPR_TIMESPAN)); gpr_timespec last_warning_time = gpr_now(GPR_CLOCK_REALTIME); - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_iomgr_platform_flush(); @@ -104,10 +103,9 @@ void grpc_iomgr_shutdown(void) { } last_warning_time = gpr_now(GPR_CLOCK_REALTIME); } - if (grpc_timer_check(&exec_ctx, gpr_inf_future(GPR_CLOCK_MONOTONIC), - NULL)) { + if (grpc_timer_check(exec_ctx, gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL)) { gpr_mu_unlock(&g_mu); - grpc_exec_ctx_flush(&exec_ctx); + grpc_exec_ctx_flush(exec_ctx); gpr_mu_lock(&g_mu); continue; } @@ -138,8 +136,8 @@ void grpc_iomgr_shutdown(void) { } gpr_mu_unlock(&g_mu); - grpc_timer_list_shutdown(&exec_ctx); - grpc_exec_ctx_finish(&exec_ctx); + grpc_timer_list_shutdown(exec_ctx); + grpc_exec_ctx_flush(exec_ctx); /* ensure all threads have left g_mu */ gpr_mu_lock(&g_mu); diff --git a/src/core/lib/iomgr/iomgr.h b/src/core/lib/iomgr/iomgr.h index c1cfaf302e..245a1e08aa 100644 --- a/src/core/lib/iomgr/iomgr.h +++ b/src/core/lib/iomgr/iomgr.h @@ -34,12 +34,14 @@ #ifndef GRPC_CORE_LIB_IOMGR_IOMGR_H #define GRPC_CORE_LIB_IOMGR_IOMGR_H +#include <grpc/impl/codegen/exec_ctx_fwd.h> #include "src/core/lib/iomgr/port.h" /** Initializes the iomgr. */ void grpc_iomgr_init(void); -/** Signals the intention to shutdown the iomgr. */ -void grpc_iomgr_shutdown(void); +/** Signals the intention to shutdown the iomgr. Expects to be able to flush + * exec_ctx. */ +void grpc_iomgr_shutdown(grpc_exec_ctx *exec_ctx); #endif /* GRPC_CORE_LIB_IOMGR_IOMGR_H */ |