-/** Execute all the tasks that are queued, e.g. `.then()` callbacks of futures. */
-bool EngineImpl::execute_tasks()
-{
- if (tasks.empty())
- return false;
-
- std::vector<xbt::Task<void()>> tasksTemp;
- do {
- // We don't want the callbacks to modify the vector we are iterating over:
- tasks.swap(tasksTemp);
-
- // Execute all the queued tasks:
- for (auto& task : tasksTemp)
- task();
-
- tasksTemp.clear();
- } while (not tasks.empty());
-
- return true;
-}
-