File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 2121
2222#include < grpc/support/port_platform.h>
2323
24+ #include < limits>
25+
2426#include < grpc/impl/codegen/grpc_types.h>
2527#include < grpc/support/atm.h>
2628#include < grpc/support/cpu.h>
@@ -132,7 +134,12 @@ class ExecCtx {
132134 ExecCtx (const ExecCtx&) = delete ;
133135 ExecCtx& operator =(const ExecCtx&) = delete ;
134136
135- unsigned starting_cpu () const { return starting_cpu_; }
137+ unsigned starting_cpu () {
138+ if (starting_cpu_ == std::numeric_limits<unsigned >::max ()) {
139+ starting_cpu_ = gpr_cpu_current_cpu ();
140+ }
141+ return starting_cpu_;
142+ }
136143
137144 struct CombinerData {
138145 /* currently active combiner: updated only via combiner.c */
@@ -239,7 +246,7 @@ class ExecCtx {
239246 CombinerData combiner_data_ = {nullptr , nullptr };
240247 uintptr_t flags_;
241248
242- unsigned starting_cpu_ = gpr_cpu_current_cpu ();
249+ unsigned starting_cpu_ = std::numeric_limits< unsigned >::max ();
243250
244251 bool now_is_valid_ = false ;
245252 grpc_millis now_ = 0 ;
You can’t perform that action at this time.
0 commit comments