namespace simgrid {
namespace s4u {
-class ConditionVariable;
-
/** @brief A classical mutex, but blocking in the simulation world
* @ingroup s4u_api
*
* <a href="http://en.cppreference.com/w/cpp/thread/mutex>std::mutex</a>.
*
* As for any S4U object, Mutexes are using the @ref s4u_raii "RAII idiom" for memory management.
- * Use createMutex() to get a ::MutexPtr to a newly created mutex and only manipulate ::MutexPtr.
+ * Use create() to get a simgrid::s4u::MutexPtr to a newly created mutex and only manipulate simgrid::s4u::MutexPtr.
*
*/
class XBT_PUBLIC Mutex {
- friend ConditionVariable;
+ friend simgrid::s4u::ConditionVariable;
friend simgrid::kernel::activity::MutexImpl;
- simgrid::kernel::activity::MutexImpl* mutex_;
- explicit Mutex(simgrid::kernel::activity::MutexImpl * mutex) : mutex_(mutex) {}
+
+ simgrid::kernel::activity::MutexImpl* pimpl_;
+ explicit Mutex(simgrid::kernel::activity::MutexImpl* mutex) : pimpl_(mutex) {}
/* refcounting */
friend XBT_PUBLIC void intrusive_ptr_add_ref(Mutex* mutex);
friend XBT_PUBLIC void intrusive_ptr_release(Mutex* mutex);
public:
- using Ptr = boost::intrusive_ptr<Mutex>;
-
// No copy:
/** You cannot create a new mutex by copying an existing one. Use MutexPtr instead */
Mutex(Mutex const&) = delete;
Mutex& operator=(Mutex const&) = delete;
/** Constructs a new mutex */
- static Ptr createMutex();
+ static MutexPtr create();
void lock();
void unlock();
bool try_lock();
-};
-using MutexPtr = Mutex::Ptr;
+ // deprecated
+ /** @deprecated Mutex::create() */
+ XBT_ATTRIB_DEPRECATED_v323("Please use Mutex::create()") static MutexPtr createMutex() { return create(); }
+};
}} // namespace simgrid::s4u