Merge pull request #14712 from yashykt/hotplugcpu

Add checking for hotplugged CPUs in gpr_cpu_current_cpu for linux
pull/14714/head
Yash Tibrewal 7 years ago committed by GitHub
commit 3681ca350b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/core/lib/gpr/cpu_linux.cc

@ -71,6 +71,10 @@ unsigned gpr_cpu_current_cpu(void) {
gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", strerror(errno));
return 0;
}
if (static_cast<unsigned>(cpu) >= gpr_cpu_num_cores()) {
gpr_log(GPR_ERROR, "Cannot handle hot-plugged CPUs");
return 0;
}
return static_cast<unsigned>(cpu);
#endif
}

Loading…
Cancel
Save