Skip to content

Commit

Permalink
CpuSet: Return void from CLR
Browse files Browse the repository at this point in the history
CPU_CLR_S is documented to return void, but CpuSet::CLR was using it as a bool.
This happened to compile with glibc, but is wrong in general.

The return value of CLR is never used, so return void instead of bool.
CpuSet is an internal class.

https://man7.org/linux/man-pages/man3/CPU_SET.3.html

PiperOrigin-RevId: 704991349
Change-Id: I67ab5469055a298111fd452ce63ca4c6f2682387
  • Loading branch information
TCMalloc Team authored and copybara-github committed Dec 11, 2024
1 parent 6fba903 commit 36c213b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tcmalloc/internal/cpu_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CpuSet {
bool IsSet(int cpu) const {
return CPU_ISSET_S(cpu, kCpuSetBytes, cpu_set_.data());
}
bool CLR(int cpu) { return CPU_CLR_S(cpu, kCpuSetBytes, cpu_set_.data()); }
void CLR(int cpu) { CPU_CLR_S(cpu, kCpuSetBytes, cpu_set_.data()); }
int Count() const { return CPU_COUNT_S(kCpuSetBytes, cpu_set_.data()); }

// Find the index of the first set CPU. Returns -1 if none are set.
Expand Down

0 comments on commit 36c213b

Please sign in to comment.