- if (SD_INITIALISED()) {
- DEBUG0("Destroying workstation and link dictionaries...");
- xbt_dict_free(&sd_global->workstations);
- xbt_dict_free(&sd_global->links);
-
- DEBUG0("Destroying workstation and link arrays if necessary...");
- if (sd_global->workstation_list != NULL)
- xbt_free(sd_global->workstation_list);
-
- if (sd_global->link_list != NULL)
- xbt_free(sd_global->link_list);
-
- if (sd_global->recyclable_route != NULL)
- xbt_free(sd_global->recyclable_route);
-
- DEBUG0("Destroying the swags...");
- xbt_swag_free(sd_global->not_scheduled_task_set);
- xbt_swag_free(sd_global->schedulable_task_set);
- xbt_swag_free(sd_global->scheduled_task_set);
- xbt_swag_free(sd_global->runnable_task_set);
- xbt_swag_free(sd_global->in_fifo_task_set);
- xbt_swag_free(sd_global->running_task_set);
- xbt_swag_free(sd_global->done_task_set);
- xbt_swag_free(sd_global->failed_task_set);
-
- xbt_free(sd_global);
- sd_global = NULL;
-
- DEBUG0("Exiting Surf...");
- surf_exit();
- } else {
- WARN0("SD_exit() called, but SimDag is not running");
- /* we cannot use exceptions here because xbt is not running! */
- }