SimGrid  3.16
Versatile Simulation of Distributed Systems
Explicit Synchronization Functions

Detailed Description

Explicit synchronization mechanisms: semaphores (msg_sem_t) and friends.

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

Classes

struct  s_msg_bar
 

Macros

#define MSG_BARRIER_SERIAL_PROCESS   -1
 Opaque type representing a barrier identifier. More...
 
#define MSG_BARRIER_SERIAL_PROCESS   -1
 Opaque type representing a barrier identifier. More...
 

Typedefs

typedef struct s_smx_semmsg_sem_t
 Opaque type representing a semaphore. More...
 
typedef struct s_msg_bar s_msg_bar_t
 
typedef struct s_smx_semmsg_sem_t
 Opaque type representing a semaphore. More...
 
typedef struct s_msg_bar s_msg_bar_t
 

Functions

msg_sem_t MSG_sem_init (int initial_value)
 creates a semaphore object of the given initial capacity More...
 
void MSG_sem_acquire (msg_sem_t sem)
 locks on a semaphore object More...
 
msg_error_t MSG_sem_acquire_timeout (msg_sem_t sem, double timeout)
 locks on a semaphore object up until the provided timeout expires More...
 
void MSG_sem_release (msg_sem_t sem)
 releases the semaphore object More...
 
int MSG_sem_get_capacity (msg_sem_t sem)
 
void MSG_sem_destroy (msg_sem_t sem)
 
int MSG_sem_would_block (msg_sem_t sem)
 returns a boolean indicating if this semaphore would block at this very specific time More...
 
msg_bar_t MSG_barrier_init (unsigned int count)
 Initializes a barrier, with count elements. More...
 
void MSG_barrier_destroy (msg_bar_t bar)
 Initializes a barrier, with count elements. More...
 
int MSG_barrier_wait (msg_bar_t bar)
 Performs a barrier already initialized. More...
 

Macro Definition Documentation

◆ MSG_BARRIER_SERIAL_PROCESS [1/2]

#define MSG_BARRIER_SERIAL_PROCESS   -1

Opaque type representing a barrier identifier.

◆ MSG_BARRIER_SERIAL_PROCESS [2/2]

#define MSG_BARRIER_SERIAL_PROCESS   -1

Opaque type representing a barrier identifier.

Typedef Documentation

◆ msg_sem_t [1/2]

typedef struct s_smx_sem* msg_sem_t

Opaque type representing a semaphore.

◆ s_msg_bar_t [1/2]

typedef struct s_msg_bar s_msg_bar_t

◆ msg_sem_t [2/2]

typedef struct s_smx_sem* msg_sem_t

Opaque type representing a semaphore.

◆ s_msg_bar_t [2/2]

typedef struct s_msg_bar s_msg_bar_t

Function Documentation

◆ MSG_sem_init()

msg_sem_t MSG_sem_init ( int  initial_value)

creates a semaphore object of the given initial capacity

◆ MSG_sem_acquire()

void MSG_sem_acquire ( msg_sem_t  sem)

locks on a semaphore object

◆ MSG_sem_acquire_timeout()

msg_error_t MSG_sem_acquire_timeout ( msg_sem_t  sem,
double  timeout 
)

locks on a semaphore object up until the provided timeout expires

◆ MSG_sem_release()

void MSG_sem_release ( msg_sem_t  sem)

releases the semaphore object

◆ MSG_sem_get_capacity()

int MSG_sem_get_capacity ( msg_sem_t  sem)

◆ MSG_sem_destroy()

void MSG_sem_destroy ( msg_sem_t  sem)

◆ MSG_sem_would_block()

int MSG_sem_would_block ( msg_sem_t  sem)

returns a boolean indicating if 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.

◆ MSG_barrier_init()

msg_bar_t MSG_barrier_init ( unsigned int  count)

Initializes a barrier, with count elements.

◆ MSG_barrier_destroy()

void MSG_barrier_destroy ( msg_bar_t  bar)

Initializes a barrier, with count elements.

◆ MSG_barrier_wait()

int MSG_barrier_wait ( msg_bar_t  bar)

Performs a barrier already initialized.