Review feedback

pull/11336/head
Craig Tiller 8 years ago
parent b3899fd18b
commit 747216fcef
  1. 5
      src/core/lib/iomgr/combiner.c
  2. 4
      src/core/lib/iomgr/executor.c

@ -222,9 +222,8 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) {
if (contended && grpc_exec_ctx_ready_to_finish(exec_ctx) && if (contended && grpc_exec_ctx_ready_to_finish(exec_ctx) &&
grpc_executor_is_threaded()) { grpc_executor_is_threaded()) {
GPR_TIMER_MARK("offload_from_finished_exec_ctx", 0); GPR_TIMER_MARK("offload_from_finished_exec_ctx", 0);
// this execution context wants to move on, and we have a workqueue (and // this execution context wants to move on: schedule remaining work to be
// so can help the execution context out): schedule remaining work to be // picked up on the executor
// picked up on the workqueue
queue_offload(exec_ctx, lock); queue_offload(exec_ctx, lock);
GPR_TIMER_END("combiner.continue_exec_ctx", 0); GPR_TIMER_END("combiner.continue_exec_ctx", 0);
return true; return true;

@ -173,8 +173,8 @@ static void executor_push(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
ts->depth++; ts->depth++;
bool try_new_thread = ts->depth > MAX_DEPTH && bool try_new_thread = ts->depth > MAX_DEPTH &&
cur_thread_count < g_max_threads && !ts->shutdown; cur_thread_count < g_max_threads && !ts->shutdown;
gpr_mu_unlock(&ts->mu);
if (try_new_thread && gpr_spinlock_trylock(&g_adding_thread_lock)) { if (try_new_thread && gpr_spinlock_trylock(&g_adding_thread_lock)) {
gpr_mu_unlock(&ts->mu);
cur_thread_count = (size_t)gpr_atm_no_barrier_load(&g_cur_threads); cur_thread_count = (size_t)gpr_atm_no_barrier_load(&g_cur_threads);
if (cur_thread_count < g_max_threads) { if (cur_thread_count < g_max_threads) {
gpr_atm_no_barrier_store(&g_cur_threads, cur_thread_count + 1); gpr_atm_no_barrier_store(&g_cur_threads, cur_thread_count + 1);
@ -185,8 +185,6 @@ static void executor_push(grpc_exec_ctx *exec_ctx, grpc_closure *closure,
&g_thread_state[cur_thread_count], &opt); &g_thread_state[cur_thread_count], &opt);
} }
gpr_spinlock_unlock(&g_adding_thread_lock); gpr_spinlock_unlock(&g_adding_thread_lock);
} else {
gpr_mu_unlock(&ts->mu);
} }
} }

Loading…
Cancel
Save