X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2ca35a707044d033c33cb4f016e6ffddfded0d05..91b3883142b769ef1fc0b7d460f78d2ae526bca2:/include/simgrid/s4u/Mutex.hpp diff --git a/include/simgrid/s4u/Mutex.hpp b/include/simgrid/s4u/Mutex.hpp index 241ae36f91..9e8e317e72 100644 --- a/include/simgrid/s4u/Mutex.hpp +++ b/include/simgrid/s4u/Mutex.hpp @@ -19,14 +19,27 @@ namespace s4u { class ConditionVariable; +/** @brief A classical mutex, but blocking in the simulation world + * @ingroup s4u_api + * + * It is strictly impossible to use a real mutex, such as + * std::mutex + * or pthread_mutex_t, + * because it would block the whole simulation. + * Instead, you should use the present class, that is a drop-in replacement of + * mutex_); } +public: using Ptr = boost::intrusive_ptr; // No copy: + /** You cannot create a new mutex by copying an existing one. Use MutexPtr instead */ Mutex(Mutex const&) = delete; + /** You cannot create a new mutex by value assignment either. Use MutexPtr instead */ Mutex& operator=(Mutex const&) = delete; + /** Constructs a new mutex */ static Ptr createMutex(); -public: void lock(); void unlock(); bool try_lock();