Commit c7f05e08 authored by Gennadiy Rozental's avatar Gennadiy Rozental
Browse files

Merge pull request #2872 from elindsey:master

PiperOrigin-RevId: 320224740
parents 592d4642 a2533417
...@@ -198,7 +198,8 @@ size_t GetThreadCount() { ...@@ -198,7 +198,8 @@ size_t GetThreadCount() {
if (sysctl(mib, miblen, NULL, &size, NULL, 0)) { if (sysctl(mib, miblen, NULL, &size, NULL, 0)) {
return 0; return 0;
} }
mib[5] = size / mib[4];
mib[5] = static_cast<int>(size / static_cast<size_t>(mib[4]));
// populate array of structs // populate array of structs
struct kinfo_proc info[mib[5]]; struct kinfo_proc info[mib[5]];
...@@ -207,8 +208,8 @@ size_t GetThreadCount() { ...@@ -207,8 +208,8 @@ size_t GetThreadCount() {
} }
// exclude empty members // exclude empty members
int nthreads = 0; size_t nthreads = 0;
for (size_t i = 0; i < size / mib[4]; i++) { for (size_t i = 0; i < size / static_cast<size_t>(mib[4]); i++) {
if (info[i].p_tid != -1) if (info[i].p_tid != -1)
nthreads++; nthreads++;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment