SimGrid  3.14.159
Versatile Simulation of Distributed Systems
simgrid::simix::Mutex Class Reference

#include <smx_synchro_private.h>

Public Member Functions

 Mutex ()
 
 ~Mutex ()
 
 Mutex (Mutex const &)=delete
 
Mutexoperator= (Mutex const &)=delete
 
void lock (smx_actor_t issuer)
 
bool try_lock (smx_actor_t issuer)
 Tries to lock the mutex for a process. More...
 
void unlock (smx_actor_t issuer)
 Unlock a mutex for a process. More...
 
simgrid::s4u::Mutexmutex ()
 

Public Attributes

bool locked = false
 
smx_actor_t owner = nullptr
 
xbt_swag_t sleeping = nullptr
 

Friends

void intrusive_ptr_add_ref (Mutex *mutex)
 
void intrusive_ptr_release (Mutex *mutex)
 

Constructor & Destructor Documentation

◆ Mutex() [1/2]

simgrid::simix::Mutex::Mutex ( )

◆ ~Mutex()

simgrid::simix::Mutex::~Mutex ( )

◆ Mutex() [2/2]

simgrid::simix::Mutex::Mutex ( Mutex const &  )
delete

Member Function Documentation

◆ operator=()

Mutex& simgrid::simix::Mutex::operator= ( Mutex const &  )
delete

◆ lock()

void simgrid::simix::Mutex::lock ( smx_actor_t  issuer)

◆ try_lock()

bool simgrid::simix::Mutex::try_lock ( smx_actor_t  issuer)

Tries to lock the mutex for a process.

Parameters
issuerthe process that tries to acquire the mutex
Returns
whether we managed to lock the mutex

◆ unlock()

void simgrid::simix::Mutex::unlock ( smx_actor_t  issuer)

Unlock a mutex for a process.

Unlocks the mutex and gives it to a process waiting for it. If the unlocker is not the owner of the mutex nothing happens. If there are no process waiting, it sets the mutex as free.

◆ mutex()

simgrid::s4u::Mutex& simgrid::simix::Mutex::mutex ( )
inline

Friends And Related Function Documentation

◆ intrusive_ptr_add_ref

void intrusive_ptr_add_ref ( Mutex mutex)
friend

◆ intrusive_ptr_release

void intrusive_ptr_release ( Mutex mutex)
friend

Member Data Documentation

◆ locked

bool simgrid::simix::Mutex::locked = false

◆ owner

smx_actor_t simgrid::simix::Mutex::owner = nullptr

◆ sleeping

xbt_swag_t simgrid::simix::Mutex::sleeping = nullptr

The documentation for this class was generated from the following files: