This group is for Condition Variable.
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] | cond | handle to the condition variable |
- Returns
- Error code
- Return values
-
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] | newcond | handle to a new condition variable |
- Returns
- Error code
- Return values
-
Definition at line 26 of file cond.c.
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] | cond | handle to the condition variable |
- Returns
- Error code
- Return values
-
Definition at line 52 of file cond.c.
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] | cond | handle to the condition variable |
- Returns
- Error code
- Return values
-
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] | cond | handle to the condition variable |
[in] | mutex | handle to the mutex |
[in] | abstime | absolute time for timeout |
- Returns
- Error code
- Return values
-
ABT_SUCCESS | on success |
ABT_ERR_COND_TIMEDOUT | timeout |
Definition at line 176 of file cond.c.
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] | cond | handle to the condition variable |
[in] | mutex | handle to the mutex |
- Returns
- Error code
- Return values
-
Definition at line 92 of file cond.c.