Add checking for hotplugged CPUs in gpr_cpu_current_cpu for linux

pull/14712/head
Yash Tibrewal 7 years ago
parent b62d77f05b
commit 0b4361c1b7
  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