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

Method DoSpawnAddsThreaded

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

Source from the content-addressed store, hash-verified

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