X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a41a7f329f4931c404907ccf78a390b274780275..3f9b311ec56db95ec539001a860ae3c838c48312:/src/mc/transition/TransitionComm.cpp diff --git a/src/mc/transition/TransitionComm.cpp b/src/mc/transition/TransitionComm.cpp index 3cbf62ac81..d23cd86fb8 100644 --- a/src/mc/transition/TransitionComm.cpp +++ b/src/mc/transition/TransitionComm.cpp @@ -56,6 +56,15 @@ bool CommWaitTransition::depends(const Transition* other) const return false; // Comm transitions are INDEP with non-comm transitions } + +bool CommWaitTransition::reversible_race(const Transition* other) const +{ + xbt_assert(type_ == Type::COMM_WAIT, "Unexpected transition type %s", to_c_str(type_)); + + // If the other event is a communication event, then we are not reversible; otherwise we are reversible. + return other->type_ != Transition::Type::COMM_ASYNC_SEND && other->type_ != Transition::Type::COMM_ASYNC_RECV; +} + CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, unsigned comm_, aid_t sender_, aid_t receiver_, unsigned mbox_) : Transition(Type::COMM_TEST, issuer, times_considered) @@ -76,6 +85,7 @@ std::string CommTestTransition::to_string(bool verbose) const { return xbt::string_printf("TestComm(from %ld to %ld, mbox=%u)", sender_, receiver_, mbox_); } + bool CommTestTransition::depends(const Transition* other) const { if (other->type_ < type_) @@ -99,6 +109,12 @@ bool CommTestTransition::depends(const Transition* other) const return false; // Comm transitions are INDEP with non-comm transitions } +bool CommTestTransition::reversible_race(const Transition* other) const +{ + xbt_assert(type_ == Type::COMM_TEST, "Unexpected transition type %s", to_c_str(type_)); + return true; // CommTest is always enabled +} + CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, unsigned comm_, unsigned mbox_, int tag_) : Transition(Type::COMM_ASYNC_RECV, issuer, times_considered), comm_(comm_), mbox_(mbox_), tag_(tag_) { @@ -164,6 +180,13 @@ bool CommRecvTransition::depends(const Transition* other) const return false; // Comm transitions are INDEP with non-comm transitions } +bool CommRecvTransition::reversible_race(const Transition* other) const +{ + xbt_assert(type_ == Type::COMM_ASYNC_RECV, "Unexpected transition type %s", to_c_str(type_)); + + return true; // CommRecv is always enabled +} + CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, unsigned comm_, unsigned mbox_, int tag_) : Transition(Type::COMM_ASYNC_SEND, issuer, times_considered), comm_(comm_), mbox_(mbox_), tag_(tag_) { @@ -230,4 +253,11 @@ bool CommSendTransition::depends(const Transition* other) const return false; // Comm transitions are INDEP with non-comm transitions } +bool CommSendTransition::reversible_race(const Transition* other) const +{ + xbt_assert(type_ == Type::COMM_ASYNC_SEND, "Unexpected transition type %s", to_c_str(type_)); + + return true; // CommSend is always enabled +} + } // namespace simgrid::mc