#if HAVE_SMPI
if (SIMIX_process_count()>0){
- if(smpi_process_initialized()){
+ if(smpi_process()->initialized()){
xbt_die("Process exited without calling MPI_Finalize - Killing simulation");
}else{
XBT_WARN("Process called exit when leaving - Skipping cleanups");
xbt_os_mutex_destroy(simix_global->mutex);
simix_global->mutex = nullptr;
+#if HAVE_MC
+ xbt_dynar_free(&simix_global->actors_vector);
+#endif
/* Let's free maestro now */
delete simix_global->maestro_process->context;
/* Clean processes to destroy */
SIMIX_process_empty_trash();
- XBT_DEBUG("### time %f, empty %d", time, xbt_dynar_is_empty(simix_global->process_to_run));
+ XBT_DEBUG("### time %f, #processes %zu, #to_run %lu", time, simix_global->process_list.size(),
+ xbt_dynar_length(simix_global->process_to_run));
+
+ /* If only daemon processes remain, cancel their actions, mark them to die and reschedule them */
+ if (simix_global->process_list.size() == simix_global->daemons.size())
+ for (const auto& dmon : simix_global->daemons) {
+ XBT_DEBUG("Kill %s", dmon->cname());
+ SIMIX_process_kill(dmon, simix_global->maestro_process);
+ }
if (xbt_dynar_is_empty(simix_global->process_to_run) &&
!simix_global->process_list.empty())
int SIMIX_is_maestro()
{
- return simix_global==nullptr /*SimDag*/|| SIMIX_process_self() == simix_global->maestro_process;
+ smx_actor_t self = SIMIX_process_self();
+ return simix_global == nullptr /*SimDag*/ || self == nullptr || self == simix_global->maestro_process;
}