#include "wait_ut_common.h" #include #include #include namespace NThreading::NTest::NPrivate { void ExecuteAndWait(TVector> jobs, TFuture waiter, size_t threads) { Y_ENSURE(threads > 0); Shuffle(jobs.begin(), jobs.end()); auto pool = CreateThreadPool(threads); TManualEvent start; for (auto& j : jobs) { pool->SafeAddFunc( [&start, job = std::move(j)]() { start.WaitI(); job(); }); } start.Signal(); waiter.Wait(); pool->Stop(); } }