Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Implement pthread_join in MC mode for sthread
[simgrid.git] / src / mc / transition / TransitionActorJoin.cpp
diff --git a/src/mc/transition/TransitionActorJoin.cpp b/src/mc/transition/TransitionActorJoin.cpp
new file mode 100644 (file)
index 0000000..2f4b017
--- /dev/null
@@ -0,0 +1,40 @@
+/* Copyright (c) 2015-2022. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "src/mc/transition/TransitionActorJoin.hpp"
+#include "xbt/asserts.h"
+#include <simgrid/config.h>
+#if SIMGRID_HAVE_MC
+#include "src/mc/ModelChecker.hpp"
+#include "src/mc/api/RemoteApp.hpp"
+#include "src/mc/api/State.hpp"
+#endif
+
+#include <sstream>
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_trans_actorlifecycle, mc_transition,
+                                "Logging specific to MC transitions about actors' lifecycle: joining, ending");
+
+namespace simgrid::mc {
+
+ActorJoinTransition::ActorJoinTransition(aid_t issuer, int times_considered, std::stringstream& stream)
+    : Transition(Type::ACTOR_JOIN, issuer, times_considered)
+{
+  xbt_assert(stream >> target_ >> timeout_);
+  XBT_DEBUG("ActorJoinTransition target:%ld, %s ", target_, (timeout_ ? "timeout" : "no-timeout"));
+}
+std::string ActorJoinTransition::to_string(bool verbose) const
+{
+  return xbt::string_printf("ActorJoin(target %ld, %s)", target_, (timeout_ ? "timeout" : "no timeout"));
+}
+bool ActorJoinTransition::depends(const Transition* other) const
+{
+  // Joining is indep with any other transitions:
+  // - It is only enabled once the target ends, and after this point it's enabled no matter what
+  // - Other joins don't affect it, and it does not impact on the enabledness of any other transition
+  return false;
+}
+
+} // namespace simgrid::mc