SimGrid  3.10
Versatile Simulation of Distributed Systems
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Explicit Synchronization Functions

This section describes several explicit synchronization mechanisms existing in MSG: semaphores (msg_sem_t) and friends. More...

Typedefs

typedef struct s_smx_sem * msg_sem_t
 Opaque type representing a semaphore.

Functions

msg_sem_t MSG_sem_init (int initial_value)
 creates a semaphore object of the given initial capacity
void MSG_sem_acquire (msg_sem_t sem)
 locks on a semaphore object
msg_error_t MSG_sem_acquire_timeout (msg_sem_t sem, double timeout)
 locks on a semaphore object up until the provided timeout expires
void MSG_sem_release (msg_sem_t sem)
 releases the semaphore object
int MSG_sem_would_block (msg_sem_t sem)
 returns a boolean indicating it this semaphore would block at this very specific time

Detailed Description

This section describes several explicit synchronization mechanisms existing in MSG: semaphores (msg_sem_t) and friends.

In some situations, these things are very helpful to synchronize processes without message exchanges.

Function Documentation

int MSG_sem_would_block ( msg_sem_t  sem)

returns a boolean indicating it this semaphore would block at this very specific time

Note that the returned value may be wrong right after the function call, when you try to use it... But that's a classical semaphore issue, and SimGrid's semaphore are not different to usual ones here.