MCPcopy Create free account
hub / github.com/bytedance/bolt / waitForTaskStateChange

Function waitForTaskStateChange

bolt/exec/tests/utils/QueryAssertions.cpp:1471–1485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1469}
1470
1471bool waitForTaskStateChange(
1472 exec::Task* task,
1473 TaskState state,
1474 uint64_t maxWaitMicros) {
1475 // Wait for task to transition to finished state.
1476 if (task->state() != state) {
1477 auto& executor = folly::QueuedImmediateExecutor::instance();
1478 auto future = task->taskCompletionFuture()
1479 .within(std::chrono::microseconds(maxWaitMicros))
1480 .via(&executor);
1481 future.wait();
1482 }
1483
1484 return task->state() == state;
1485}
1486
1487void waitForAllTasksToBeDeleted(uint64_t maxWaitUs) {
1488 const uint64_t numCreatedTasks = Task::numCreatedTasks();

Callers 3

DEBUG_ONLY_TEST_FFunction · 0.85
waitForTaskFinishMethod · 0.85
waitForTaskFinishFunction · 0.85

Calls 3

taskCompletionFutureMethod · 0.80
waitMethod · 0.80
stateMethod · 0.45

Tested by

no test coverage detected