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

Function StressFailingTaskGroupLifetime

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

Same, but with also a failing task

Source from the content-addressed store, hash-verified

256
257// Same, but with also a failing task
258void StressFailingTaskGroupLifetime(std::function<std::shared_ptr<TaskGroup>()> factory) {
259 const int NTASKS = 100;
260 auto task_group = factory();
261 auto weak_group_ptr = std::weak_ptr<TaskGroup>(task_group);
262
263 std::atomic<bool> barrier(false);
264
265 BarrierTask task{&barrier, weak_group_ptr, Status::OK()};
266 BarrierTask failing_task{&barrier, weak_group_ptr, Status::Invalid("XXX")};
267
268 for (int i = 0; i < NTASKS; ++i) {
269 task_group->Append(task);
270 }
271 task_group->Append(failing_task);
272
273 // Lose strong reference
274 barrier.store(true);
275 task_group.reset();
276
277 // Wait for finish
278 while (!weak_group_ptr.expired()) {
279 SleepFor(1e-5);
280 }
281}
282
283void TestNoCopyTask(std::shared_ptr<TaskGroup> task_group) {
284 auto counter = std::make_shared<uint8_t>(0);

Callers 1

TESTFunction · 0.85

Calls 7

factoryFunction · 0.85
SleepForFunction · 0.85
storeMethod · 0.80
OKFunction · 0.50
InvalidFunction · 0.50
AppendMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected