Skip to content

Commit

Permalink
Improve integer type safety in static_thread_pool.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
vasama committed Nov 15, 2023
1 parent fea7e8f commit 5aad30f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/exec/static_thread_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ namespace exec {
++idx;
}
remote_queue* correct_queue = this_id == queue.id_ ? &queue : get_remote_queue();
std::size_t nThreads = available_parallelism();
for (std::size_t i = 0; i < nThreads; ++i) {
std::uint32_t nThreads = available_parallelism();
for (std::uint32_t i = 0; i < nThreads; ++i) {
auto [i0, iEnd] = even_share(nTasks, i, available_parallelism());
if (i0 == iEnd) {
continue;
Expand Down Expand Up @@ -676,8 +676,8 @@ namespace exec {
if (victims_.empty()) {
return {nullptr, index_};
}
std::uniform_int_distribution<std::uint32_t> dist(0, victims_.size() - 1);
std::uint32_t victimIndex = dist(rng_);
std::uniform_int_distribution<std::size_t> dist(0, victims_.size() - 1);
std::size_t victimIndex = dist(rng_);
auto& v = victims_[victimIndex];
return {v.try_steal(), v.index()};
}
Expand Down

0 comments on commit 5aad30f

Please sign in to comment.