|
|
|
@ -29,6 +29,7 @@ |
|
|
|
|
|
|
|
|
|
#include "src/core/lib/debug/stats.h" |
|
|
|
|
#include "src/core/lib/iomgr/executor.h" |
|
|
|
|
#include "src/core/lib/iomgr/iomgr.h" |
|
|
|
|
#include "src/core/lib/profiling/timers.h" |
|
|
|
|
|
|
|
|
|
grpc_core::DebugOnlyTraceFlag grpc_combiner_trace(false, "combiner"); |
|
|
|
@ -228,8 +229,14 @@ bool grpc_combiner_continue_exec_ctx() { |
|
|
|
|
grpc_core::ExecCtx::Get()->IsReadyToFinish(), |
|
|
|
|
lock->time_to_execute_final_list)); |
|
|
|
|
|
|
|
|
|
// offload only if all the following conditions are true:
|
|
|
|
|
// 1. the combiner is contended and has more than one closure to execute
|
|
|
|
|
// 2. the current execution context needs to finish as soon as possible
|
|
|
|
|
// 3. the DEFAULT executor is threaded
|
|
|
|
|
// 4. the current thread is not a worker for any background poller
|
|
|
|
|
if (contended && grpc_core::ExecCtx::Get()->IsReadyToFinish() && |
|
|
|
|
grpc_executor_is_threaded()) { |
|
|
|
|
grpc_executor_is_threaded() && |
|
|
|
|
!grpc_iomgr_is_any_background_poller_thread()) { |
|
|
|
|
GPR_TIMER_MARK("offload_from_finished_exec_ctx", 0); |
|
|
|
|
// this execution context wants to move on: schedule remaining work to be
|
|
|
|
|
// picked up on the executor
|
|
|
|
|