SimGrid
3.21
Versatile Simulation of Distributed Systems
|
A classical semaphore, but blocking in the simulation world
It is strictly impossible to use a real semaphore, such as sem_init, because it would block the whole simulation.
Instead, you should use the present class, that offers a very similar interface.
As for any S4U object, Semaphores are using the RAII idiom for memory management. Use create() to get a simgrid::s4u::SemaphorePtr to a newly created semaphore and only manipulate simgrid::s4u::SemaphorePtr.
#include <Semaphore.hpp>
Public Member Functions | |
Semaphore (Semaphore const &)=delete | |
You cannot create a new semaphore by copying an existing one. More... | |
Semaphore & | operator= (Semaphore const &)=delete |
You cannot create a new semaphore by value assignment either. More... | |
void | acquire () |
void | release () |
Static Public Member Functions | |
static SemaphorePtr | create (unsigned int initial_capacity) |
Constructs a new semaphore. More... | |
Friends | |
void | intrusive_ptr_add_ref (Semaphore *sem) |
void | intrusive_ptr_release (Semaphore *sem) |
|
delete |
You cannot create a new semaphore by copying an existing one.
Use SemaphorePtr instead
You cannot create a new semaphore by value assignment either.
Use SemaphorePtr instead
|
static |
Constructs a new semaphore.
void simgrid::s4u::Semaphore::acquire | ( | ) |
void simgrid::s4u::Semaphore::release | ( | ) |
|
friend |
|
friend |