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

Method DoSpawnAddsThreaded

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

Source from the content-addressed store, hash-verified

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