ARGOBOTS
Functions
Condition Variable

Functions

int ABT_cond_create (ABT_cond *newcond)
 Create a new condition variable. More...
 
int ABT_cond_free (ABT_cond *cond)
 Free the condition variable. More...
 
int ABT_cond_wait (ABT_cond cond, ABT_mutex mutex)
 Wait on the condition. More...
 
int ABT_cond_timedwait (ABT_cond cond, ABT_mutex mutex, const struct timespec *abstime)
 Wait on the condition. More...
 
int ABT_cond_signal (ABT_cond cond)
 Signal a condition. More...
 
int ABT_cond_broadcast (ABT_cond cond)
 Broadcast a condition. More...
 

Detailed Description

This group is for Condition Variable.

Function Documentation

int ABT_cond_broadcast ( ABT_cond  cond)

Broadcast a condition.

ABT_cond_broadcast() signals all ULTs that are waiting on the condition variable. This routine shall have no effect if no ULTs are currently blocked on the condition variable.

Parameters
[in]condhandle to the condition variable
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 336 of file cond.c.

int ABT_cond_create ( ABT_cond newcond)

Create a new condition variable.

ABT_cond_create() creates a new condition variable and returns its handle through newcond. If an error occurs in this routine, a non-zero error code will be returned and newcond will be set to ABT_COND_NULL.

Parameters
[out]newcondhandle to a new condition variable
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 26 of file cond.c.

int ABT_cond_free ( ABT_cond cond)

Free the condition variable.

ABT_cond_free() deallocates the memory used for the condition variable object associated with the handle cond. If it is successfully processed, cond is set to ABT_COND_NULL.

Parameters
[in,out]condhandle to the condition variable
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 52 of file cond.c.

int ABT_cond_signal ( ABT_cond  cond)

Signal a condition.

ABT_cond_signal() signals another ULT that is waiting on the condition variable. Only one ULT is waken up by the signal and the scheduler determines the ULT. This routine shall have no effect if no ULTs are currently blocked on the condition variable.

Parameters
[in]condhandle to the condition variable
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 273 of file cond.c.

int ABT_cond_timedwait ( ABT_cond  cond,
ABT_mutex  mutex,
const struct timespec *  abstime 
)

Wait on the condition.

The ULT calling ABT_cond_timedwait() waits on the condition variable until it is signaled or the absolute time specified by abstime passes. If system time equals or exceeds abstime before cond is signaled, the error code ABT_ERR_COND_TIMEDOUT is returned.

The user should call this routine while the mutex specified as mutex is locked. The mutex will be automatically released while waiting. After signal is received and the waiting ULT is awakened, the mutex will be automatically locked for use by the ULT. The user is then responsible for unlocking mutex when the ULT is finished with it.

Parameters
[in]condhandle to the condition variable
[in]mutexhandle to the mutex
[in]abstimeabsolute time for timeout
Returns
Error code
Return values
ABT_SUCCESSon success
ABT_ERR_COND_TIMEDOUTtimeout

Definition at line 176 of file cond.c.

int ABT_cond_wait ( ABT_cond  cond,
ABT_mutex  mutex 
)

Wait on the condition.

The ULT calling ABT_cond_wait() waits on the condition variable until it is signaled. The user should call this routine while the mutex specified as mutex is locked. The mutex will be automatically released while waiting. After signal is received and the waiting ULT is awakened, the mutex will be automatically locked for use by the ULT. The user is then responsible for unlocking mutex when the ULT is finished with it.

Parameters
[in]condhandle to the condition variable
[in]mutexhandle to the mutex
Returns
Error code
Return values
ABT_SUCCESSon success

Definition at line 92 of file cond.c.