MCPcopy Create free account
hub / github.com/apache/arrow / DoSpawnAddsThreaded

Method DoSpawnAddsThreaded

cpp/src/arrow/util/thread_pool_test.cc:526–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

524 }
525
526 void DoSpawnAddsThreaded(ThreadPool* pool, int nthreads, int nadds,
527 AddTaskFunc add_func,
528 StopToken stop_token = StopToken::Unstoppable(),
529 StopSource* stop_source = nullptr) {
530 // Same as SpawnAdds, but do the task spawning from multiple threads
531 std::vector<AddTester> add_testers;
532 std::vector<std::thread> threads;
533 for (int i = 0; i < nthreads; ++i) {
534 add_testers.emplace_back(nadds, stop_token);
535 }
536 for (auto& add_tester : add_testers) {
537 threads.emplace_back([&] { add_tester.SpawnTasks(pool, add_func); });
538 }
539 if (stop_source) {
540 stop_source->RequestStop();
541 }
542 for (auto& thread : threads) {
543 thread.join();
544 }
545 ASSERT_OK(pool->Shutdown());
546 for (auto& add_tester : add_testers) {
547 if (stop_source) {
548 add_tester.CheckNotAllComputed();
549 } else {
550 add_tester.CheckResults();
551 }
552 }
553 }
554
555 void SpawnAddsThreaded(ThreadPool* pool, int nthreads, int nadds, AddTaskFunc add_func,
556 StopToken stop_token = StopToken::Unstoppable()) {

Callers

nothing calls this directly

Calls 8

UnstoppableFunction · 0.85
emplace_backMethod · 0.80
SpawnTasksMethod · 0.80
RequestStopMethod · 0.80
CheckNotAllComputedMethod · 0.80
joinMethod · 0.45
ShutdownMethod · 0.45
CheckResultsMethod · 0.45

Tested by

no test coverage detected