X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d0a8cb4f92bd372f091430671bd30f4422674d76..3f9b311ec56db95ec539001a860ae3c838c48312:/src/mc/transition/TransitionActor.cpp diff --git a/src/mc/transition/TransitionActor.cpp b/src/mc/transition/TransitionActor.cpp index c0d04d1162..3e1027b576 100644 --- a/src/mc/transition/TransitionActor.cpp +++ b/src/mc/transition/TransitionActor.cpp @@ -27,6 +27,10 @@ std::string ActorJoinTransition::to_string(bool verbose) const } bool ActorJoinTransition::depends(const Transition* other) const { + // Actions executed by the same actor are always dependent + if (other->aid_ == aid_) + return true; + // Joining is dependent with any transition whose // actor is that of the `other` action. , Join i if (other->aid_ == target_) { @@ -43,7 +47,16 @@ bool ActorJoinTransition::depends(const Transition* other) const return false; } -ActorSleepTransition::ActorSleepTransition(aid_t issuer, int times_considered, std::stringstream& stream) +bool ActorJoinTransition::reversible_race(const Transition* other) const +{ + xbt_assert(type_ == Type::ACTOR_JOIN, "Unexpected transition type %s", to_c_str(type_)); + + // ActorJoin races with another event iff its target `T` is the same as the actor executing the other transition. + // Clearly, then, we could not join on that actor `T` and then run a transition by `T`, so no race is reversible + return false; +} + +ActorSleepTransition::ActorSleepTransition(aid_t issuer, int times_considered, std::stringstream&) : Transition(Type::ACTOR_SLEEP, issuer, times_considered) { XBT_DEBUG("ActorSleepTransition()"); @@ -54,8 +67,19 @@ std::string ActorSleepTransition::to_string(bool verbose) const } bool ActorSleepTransition::depends(const Transition* other) const { + // Actions executed by the same actor are always dependent + if (other->aid_ == aid_) + return true; + // Sleeping is indep with any other transitions: always enabled, not impacted by any transition return false; } +bool ActorSleepTransition::reversible_race(const Transition* other) const +{ + xbt_assert(type_ == Type::ACTOR_SLEEP, "Unexpected transition type %s", to_c_str(type_)); + + return true; // Always enabled +} + } // namespace simgrid::mc