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 21
21
22
22
#include < grpc/support/port_platform.h>
23
23
24
+ #include < limits>
25
+
24
26
#include < grpc/impl/codegen/grpc_types.h>
25
27
#include < grpc/support/atm.h>
26
28
#include < grpc/support/cpu.h>
@@ -132,7 +134,12 @@ class ExecCtx {
132
134
ExecCtx (const ExecCtx&) = delete ;
133
135
ExecCtx& operator =(const ExecCtx&) = delete ;
134
136
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
+ }
136
143
137
144
struct CombinerData {
138
145
/* currently active combiner: updated only via combiner.c */
@@ -239,7 +246,7 @@ class ExecCtx {
239
246
CombinerData combiner_data_ = {nullptr , nullptr };
240
247
uintptr_t flags_;
241
248
242
- unsigned starting_cpu_ = gpr_cpu_current_cpu ();
249
+ unsigned starting_cpu_ = std::numeric_limits< unsigned >::max ();
243
250
244
251
bool now_is_valid_ = false ;
245
252
grpc_millis now_ = 0 ;
You can’t perform that action at this time.
0 commit comments