Mercury
Typedefs | Functions
mercury_thread_condition.h File Reference
#include "mercury_thread_mutex.h"
Include dependency graph for mercury_thread_condition.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef pthread_cond_t hg_thread_cond_t
 

Functions

HG_UTIL_EXPORT int hg_thread_cond_init (hg_thread_cond_t *cond)
 Initialize the condition. More...
 
HG_UTIL_EXPORT int hg_thread_cond_destroy (hg_thread_cond_t *cond)
 Destroy the condition. More...
 
HG_UTIL_EXPORT int hg_thread_cond_signal (hg_thread_cond_t *cond)
 Wake one thread waiting for the condition to change. More...
 
HG_UTIL_EXPORT int hg_thread_cond_broadcast (hg_thread_cond_t *cond)
 Wake all the threads waiting for the condition to change. More...
 
HG_UTIL_EXPORT int hg_thread_cond_wait (hg_thread_cond_t *cond, hg_thread_mutex_t *mutex)
 Wait for the condition to change. More...
 
HG_UTIL_EXPORT int hg_thread_cond_timedwait (hg_thread_cond_t *cond, hg_thread_mutex_t *mutex, unsigned int timeout)
 Wait timeout ms for the condition to change. More...
 

Typedef Documentation

typedef pthread_cond_t hg_thread_cond_t

Definition at line 19 of file mercury_thread_condition.h.

Function Documentation

HG_UTIL_EXPORT int hg_thread_cond_init ( hg_thread_cond_t cond)

Initialize the condition.

Parameters
cond[IN/OUT] pointer to condition object
Returns
Non-negative on success or negative on failure
HG_UTIL_EXPORT int hg_thread_cond_destroy ( hg_thread_cond_t cond)

Destroy the condition.

Parameters
cond[IN/OUT] pointer to condition object
Returns
Non-negative on success or negative on failure
HG_UTIL_EXPORT int hg_thread_cond_signal ( hg_thread_cond_t cond)

Wake one thread waiting for the condition to change.

Parameters
cond[IN/OUT] pointer to condition object
Returns
Non-negative on success or negative on failure
HG_UTIL_EXPORT int hg_thread_cond_broadcast ( hg_thread_cond_t cond)

Wake all the threads waiting for the condition to change.

Parameters
cond[IN/OUT] pointer to condition object
Returns
Non-negative on success or negative on failure
HG_UTIL_EXPORT int hg_thread_cond_wait ( hg_thread_cond_t cond,
hg_thread_mutex_t mutex 
)

Wait for the condition to change.

Parameters
cond[IN/OUT] pointer to condition object
mutex[IN/OUT] pointer to mutex object
Returns
Non-negative on success or negative on failure
HG_UTIL_EXPORT int hg_thread_cond_timedwait ( hg_thread_cond_t cond,
hg_thread_mutex_t mutex,
unsigned int  timeout 
)

Wait timeout ms for the condition to change.

Parameters
cond[IN/OUT] pointer to condition object
mutex[IN/OUT] pointer to mutex object
timeout[IN] timeout (in milliseconds)
Returns
Non-negative on success or negative on failure