SimGrid
3.21
Versatile Simulation of Distributed Systems
|
A classical mutex, but blocking in the simulation world
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 <a href="http://en.cppreference.com/w/cpp/thread/mutex>std::mutex.
As for any S4U object, Mutexes are using the RAII idiom for memory management. Use create() to get a simgrid::s4u::MutexPtr to a newly created mutex and only manipulate simgrid::s4u::MutexPtr.
#include <Mutex.hpp>
Public Member Functions | |
Mutex (Mutex const &)=delete | |
You cannot create a new mutex by copying an existing one. More... | |
Mutex & | operator= (Mutex const &)=delete |
You cannot create a new mutex by value assignment either. More... | |
void | lock () |
void | unlock () |
bool | try_lock () |
Static Public Member Functions | |
static MutexPtr | create () |
Constructs a new mutex. More... | |
static MutexPtr | createMutex () |
Friends | |
void | intrusive_ptr_add_ref (Mutex *mutex) |
void | intrusive_ptr_release (Mutex *mutex) |
|
delete |
You cannot create a new mutex by copying an existing one.
Use MutexPtr instead
You cannot create a new mutex by value assignment either.
Use MutexPtr instead
|
static |
Constructs a new mutex.
void simgrid::s4u::Mutex::lock | ( | ) |
void simgrid::s4u::Mutex::unlock | ( | ) |
bool simgrid::s4u::Mutex::try_lock | ( | ) |
|
inlinestatic |
|
friend |
|
friend |