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

Function TestFinishAlreadyCompleted

cpp/src/arrow/util/task_group_test.cc:337–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337void TestFinishAlreadyCompleted(std::function<std::shared_ptr<TaskGroup>()> factory) {
338 // If we call FinishAsync we are done adding tasks so even if no tasks are running we
339 // should still be completed
340 const int NTASKS = 100;
341 for (int i = 0; i < NTASKS; ++i) {
342 auto task_group = factory();
343 // Add a task and let it complete
344 task_group->Append([] { return Status::OK(); });
345 // Wait a little bit, hopefully enough time for the task to finish on one of these
346 // iterations
347 SleepFor(1e-2);
348 auto finished = task_group->FinishAsync();
349 ASSERT_FINISHES_OK(finished);
350 }
351}
352
353TEST(SerialTaskGroup, Success) { TestTaskGroupSuccess(TaskGroup::MakeSerial()); }
354

Callers 1

TESTFunction · 0.85

Calls 5

factoryFunction · 0.85
SleepForFunction · 0.85
OKFunction · 0.50
AppendMethod · 0.45
FinishAsyncMethod · 0.45

Tested by

no test coverage detected