#include <xbt/function_types.h>
#include <xbt/future.hpp>
#include <xbt/functional.hpp>
+#include <xbt/signal.hpp>
#include <simgrid/simix.h>
XBT_PUBLIC(void) registerFunction(const char* name, ActorCodeFactory factory);
+/** These functions will be called when we detect a deadlock: any remaining process is locked on an action
+ *
+ * If these functions manage to unlock some of the processes, then the deadlock will be avoided.
+ */
+extern simgrid::xbt::signal<void(void)> onDeadlock;
}
}
namespace simgrid {
namespace simix {
+simgrid::xbt::signal<void(void)> onDeadlock;
+
XBT_PUBLIC(void) set_maestro(std::function<void()> code)
{
maestro_code = std::move(code);
XBT_DEBUG("### time %f, empty %d", time, xbt_dynar_is_empty(simix_global->process_to_run));
+ if (xbt_dynar_is_empty(simix_global->process_to_run) &&
+ xbt_swag_size(simix_global->process_list) != 0)
+ simgrid::simix::onDeadlock();
+
} while (time > -1.0 || !xbt_dynar_is_empty(simix_global->process_to_run));
if (xbt_swag_size(simix_global->process_list) != 0) {
- TRACE_end();
+ TRACE_end();
XBT_CRITICAL("Oops ! Deadlock or code not perfectly clean.");
SIMIX_display_process_status();