/** Wait MC guiding class that aims at minimizing the number of in-fly communication.
* When possible, it will try to take the wait transition. */
class WaitStrategy : public Strategy {
- double taken_wait_ = 0;
- bool taking_wait_ = false;
+ int taken_wait_ = 0;
+ bool taking_wait_ = false;
public:
- void operator=(const WaitStrategy& guide) { taken_wait_ = guide.taken_wait_; }
+ WaitStrategy() = default;
+ ~WaitStrategy() override = default;
+ WaitStrategy(const BasicStrategy&) = delete;
+ WaitStrategy& operator=(const WaitStrategy& guide)
+ {
+ taken_wait_ = guide.taken_wait_;
+ return *this;
+ }
bool is_transition_wait(Transition::Type type) const
{
type == Transition::Type::MUTEX_WAIT or type == Transition::Type::SEM_WAIT;
}
- std::pair<aid_t, double> next_transition() const override
+ std::pair<aid_t, int> next_transition() const override
{
- std::pair<aid_t, double> if_no_wait = std::make_pair(-1, 0.0);
+ std::pair<aid_t, int> if_no_wait = std::make_pair(-1, 0);
for (auto const& [aid, actor] : actors_to_run_) {
if (not actor.is_todo() || not actor.is_enabled() || actor.is_done())
continue;
* to decrease the count. */
void execute_next(aid_t aid, RemoteApp& app) override
{
- auto& actor = actors_to_run_.at(aid);
+ auto const& actor = actors_to_run_.at(aid);
if ((not taking_wait_) and is_transition_wait(actor.get_transition(actor.get_times_considered())->type_)) {
taken_wait_++;
taking_wait_ = true;
void consider_best() override
{
- const auto& [aid, _] = this->next_transition();
- auto actor = actors_to_run_.find(aid);
- if (actor != actors_to_run_.end()) {
+ aid_t aid = next_transition().first;
+ if (auto actor = actors_to_run_.find(aid); actor != actors_to_run_.end()) {
actor->second.mark_todo();
return;
}