MCPcopy Create free account
hub / github.com/NVIDIA/stdexec / try_steal

Method try_steal

include/exec/static_thread_pool.hpp:1021–1034  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1019 }
1020
1021 inline auto _static_thread_pool::thread_state::try_steal(std::span<workstealing_victim> victims)
1022 -> _static_thread_pool::thread_state::pop_result
1023 {
1024 if (victims.empty())
1025 {
1026 return {.task = nullptr, .queue_index = index_};
1027 }
1028 std::uniform_int_distribution<std::uint32_t> dist(0,
1029 static_cast<std::uint32_t>(victims.size()
1030 - 1));
1031 std::uint32_t victim_index = dist(rng_);
1032 auto& v = victims[victim_index];
1033 return {.task = v.try_steal(), .queue_index = v.index()};
1034 }
1035
1036 inline auto _static_thread_pool::thread_state::try_steal_near()
1037 -> _static_thread_pool::thread_state::pop_result

Callers

nothing calls this directly

Calls 3

emptyMethod · 0.45
sizeMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected