1 /* Copyright (c) 2019-2022. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #ifndef SIMGRID_MC_MUTEX_OBSERVER_HPP
7 #define SIMGRID_MC_MUTEX_OBSERVER_HPP
9 #include "simgrid/forward.h"
10 #include "src/kernel/activity/MutexImpl.hpp"
11 #include "src/kernel/actor/ActorImpl.hpp"
12 #include "src/kernel/actor/SimcallObserver.hpp"
20 /* All the observers of Mutex transitions are very similar, so implement them all together in this class */
21 class MutexObserver : public SimcallObserver {
22 mc::Transition::Type type_;
23 activity::MutexImpl* const mutex_;
26 MutexObserver(ActorImpl* actor, mc::Transition::Type type, activity::MutexImpl* mutex);
28 void serialize(std::stringstream& stream) const override;
29 activity::MutexImpl* get_mutex() const { return mutex_; }
30 bool is_enabled() override;
35 } // namespace simgrid