A condition condition variable is a synchronization object that allows tasks to suspend execution until some predicate on shared data is satisfied. The basic operations on conditions are: signal the condition (when the predicate becomes true), and wait for the condition, blocking the task execution until another task signals the condition. A condition variable must always be associated with a mutex, to avoid a well-known race condition where a task prepares to wait on a condition variable and another task signals the condition just before the first task actually waits on it.
Files | |
file | cond.c |
This file is part of the RTAI project. | |
Functions | |
int | rt_cond_create (RT_COND *cond, const char *name) |
Create a condition variable. | |
int | rt_cond_delete (RT_COND *cond) |
Delete a condition variable. | |
int | rt_cond_signal (RT_COND *cond) |
Signal a condition variable. | |
int | rt_cond_broadcast (RT_COND *cond) |
Broadcast a condition variable. | |
int | rt_cond_wait (RT_COND *cond, RT_MUTEX *mutex, RTIME timeout) |
Wait on a condition. | |
int | rt_cond_inquire (RT_COND *cond, RT_COND_INFO *info) |
Inquire about a condition variable. |
|
Broadcast a condition variable. If the condition variable is pended, all tasks currently waiting on it are immediately unblocked.
Side-effect: This routine calls the rescheduling procedure if one or more tasks are woken up as a result of the operation. Context: This routine can be called on behalf of a task, interrupt context or from the initialization code. |
|
Create a condition variable. Create a synchronization object that allows tasks to suspend execution until some predicate on shared data is satisfied.
Context: This routine can be called on behalf of a task or from the initialization code. |
|
Delete a condition variable. Destroy a condition variable and release all the tasks currently pending on it. A condition variable exists in the system since rt_cond_create() has been called to create it, so this service must be called in order to destroy it afterwards.
Side-effect: This routine calls the rescheduling procedure if tasks have been woken up as a result of the deletion. Context: This routine can always be called on behalf of a task, or from the initialization code. |
|
Inquire about a condition variable. Return various information about the status of a given condition variable.
Context: This routine can be called on behalf of a task, interrupt context or from the initialization code. |
|
Signal a condition variable. If the condition variable is pended, the first waiting task (by queuing priority order) is immediately unblocked.
Side-effect: This routine calls the rescheduling procedure if a task is woken up as a result of the operation. Context: This routine can be called on behalf of a task, interrupt context or from the initialization code. |
|
Wait on a condition. This service atomically release the mutex and causes the calling task to block on the specified condition variable. The caller will be unblocked when the variable is signaled, and the mutex re-acquired before returning from this service. Tasks pend on condition variables by priority order.
Side-effect: This routine always calls the rescheduling procedure. Context: This routine must be called on behalf of a task.
|