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