| 1469 | } |
| 1470 | |
| 1471 | bool 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 | |
| 1487 | void waitForAllTasksToBeDeleted(uint64_t maxWaitUs) { |
| 1488 | const uint64_t numCreatedTasks = Task::numCreatedTasks(); |
no test coverage detected