SimGrid  3.13
Versatile Simulation of Distributed Systems

XBT synchronization tools. More...

Macros

#define XBT_BARRIER_SERIAL_PROCESS   -1
 

Typedefs

typedef struct s_smx_mutex_ * xbt_mutex_t
 Thread mutex data type (opaque object) More...
 
typedef struct s_smx_cond_ * xbt_cond_t
 Thread condition data type (opaque object) More...
 
typedef struct s_xbt_bar_xbt_bar_t
 

Functions

xbt_mutex_t xbt_mutex_init (void)
 Creates a new mutex variable. More...
 
void xbt_mutex_acquire (xbt_mutex_t mutex)
 Blocks onto the given mutex variable. More...
 
int xbt_mutex_try_acquire (xbt_mutex_t mutex)
 Tries to block onto the given mutex variable Tries to lock a mutex, return 1 if the mutex is unlocked, else 0. More...
 
void xbt_mutex_release (xbt_mutex_t mutex)
 Releases the given mutex variable. More...
 
void xbt_mutex_destroy (xbt_mutex_t mutex)
 Destroyes the given mutex variable. More...
 
xbt_cond_t xbt_cond_init (void)
 Creates a condition variable. More...
 
void xbt_cond_wait (xbt_cond_t cond, xbt_mutex_t mutex)
 Blocks onto the given condition variable. More...
 
void xbt_cond_timedwait (xbt_cond_t cond, xbt_mutex_t mutex, double delay)
 Blocks onto the given condition variable, but only for the given amount of time. More...
 
void xbt_cond_signal (xbt_cond_t cond)
 Signals the given mutex variable. More...
 
void xbt_cond_broadcast (xbt_cond_t cond)
 Broadcasts the given mutex variable. More...
 
void xbt_cond_destroy (xbt_cond_t cond)
 Destroys the given mutex variable. More...
 
xbt_bar_t xbt_barrier_init (unsigned int count)
 
void xbt_barrier_destroy (xbt_bar_t bar)
 
int xbt_barrier_wait (xbt_bar_t bar)
 

Detailed Description

XBT synchronization tools.

This section describes the XBT synchronization tools. This is a portability layer (for windows and UNIX) of a pthread-like API. Nice, isn't it?

Macro Definition Documentation

#define XBT_BARRIER_SERIAL_PROCESS   -1

Typedef Documentation

typedef struct s_smx_mutex_* xbt_mutex_t

Thread mutex data type (opaque object)

typedef struct s_smx_cond_* xbt_cond_t

Thread condition data type (opaque object)

typedef struct s_xbt_bar_* xbt_bar_t

Function Documentation

xbt_mutex_t xbt_mutex_init ( void  )

Creates a new mutex variable.

void xbt_mutex_acquire ( xbt_mutex_t  mutex)

Blocks onto the given mutex variable.

int xbt_mutex_try_acquire ( xbt_mutex_t  mutex)

Tries to block onto the given mutex variable Tries to lock a mutex, return 1 if the mutex is unlocked, else 0.

This function does not block and wait for the mutex to be unlocked.

Parameters
mutexThe mutex
Returns
1 - mutex free, 0 - mutex used
void xbt_mutex_release ( xbt_mutex_t  mutex)

Releases the given mutex variable.

void xbt_mutex_destroy ( xbt_mutex_t  mutex)

Destroyes the given mutex variable.

xbt_cond_t xbt_cond_init ( void  )

Creates a condition variable.

void xbt_cond_wait ( xbt_cond_t  cond,
xbt_mutex_t  mutex 
)

Blocks onto the given condition variable.

void xbt_cond_timedwait ( xbt_cond_t  cond,
xbt_mutex_t  mutex,
double  delay 
)

Blocks onto the given condition variable, but only for the given amount of time.

a timeout exception is raised if it was impossible to acquire it in the given time frame

void xbt_cond_signal ( xbt_cond_t  cond)

Signals the given mutex variable.

void xbt_cond_broadcast ( xbt_cond_t  cond)

Broadcasts the given mutex variable.

void xbt_cond_destroy ( xbt_cond_t  cond)

Destroys the given mutex variable.

xbt_bar_t xbt_barrier_init ( unsigned int  count)
void xbt_barrier_destroy ( xbt_bar_t  bar)
int xbt_barrier_wait ( xbt_bar_t  bar)