]> AND Public Git Repository - simgrid.git/blobdiff - src/kernel/activity/MutexImpl.hpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert simcall_process_sleep to modernity
[simgrid.git] / src / kernel / activity / MutexImpl.hpp
index 27a47c137d64a6b3a5f2455b65ccc9f77d90ac4d..3abf068229d3d039aa6040c2b9db94ae72d4a2f1 100644 (file)
@@ -15,6 +15,10 @@ namespace kernel {
 namespace activity {
 
 class XBT_PUBLIC MutexImpl {
+  std::atomic_int_fast32_t refcount_{1};
+  s4u::Mutex piface_;
+  bool locked_ = false;
+
 public:
   MutexImpl() : piface_(this) {}
   MutexImpl(MutexImpl const&) = delete;
@@ -23,10 +27,11 @@ public:
   void lock(actor::ActorImpl* issuer);
   bool try_lock(actor::ActorImpl* issuer);
   void unlock(actor::ActorImpl* issuer);
+  bool is_locked() { return locked_; }
 
   MutexImpl* ref();
   void unref();
-  bool locked_             = false;
+
   actor::ActorImpl* owner_ = nullptr;
   // List of sleeping actors:
   actor::SynchroList sleeping_;
@@ -45,10 +50,6 @@ public:
   }
 
   s4u::Mutex& mutex() { return piface_; }
-
-private:
-  std::atomic_int_fast32_t refcount_{1};
-  s4u::Mutex piface_;
 };
 }
 }