add cancel parameter for Spawner::for_each

This commit is contained in:
2025-12-04 10:30:05 -05:00
parent eec22cd791
commit 5abfedb205
2 changed files with 7 additions and 4 deletions

View File

@@ -24,7 +24,9 @@ struct Spawner {
void for_each(F&& func) {
std::lock_guard lock{mutex};
for (auto& value : values) {
func(value);
bool cancel = false;
func(value, cancel);
if (cancel) break;;
}
}