A condition variable is a synchronization object which 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 Xenomai 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. | |
int | rt_cond_bind (RT_COND *cond, const char *name, RTIME timeout) |
Bind to a condition variable. | |
static int | rt_cond_unbind (RT_COND *cond) |
Unbind from a condition variable. |
|
Bind to a condition variable. This user-space only service retrieves the uniform descriptor of a given Xenomai condition variable identified by its symbolic name. If the condition variable does not exist on entry, this service blocks the caller until a condition variable of the given name is created.
Environments: This service can be called from:
Rescheduling: always unless the request is immediately satisfied or timeout specifies a non-blocking operation.
|
|
Broadcast a condition variable. If the condition variable is pended, all tasks currently waiting on it are immediately unblocked.
Environments: This service can be called from:
Rescheduling: possible. |
|
Create a condition variable. Create a synchronization object that allows tasks to suspend execution until some predicate on shared data is satisfied.
Environments: This service can be called from:
Rescheduling: possible. |
|
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.
Environments: This service can be called from:
Rescheduling: possible. |
|
Inquire about a condition variable. Return various information about the status of a given condition variable.
Environments: This service can be called from:
Rescheduling: never. |
|
Signal a condition variable. If the condition variable is pended, the first waiting task (by queuing priority order) is immediately unblocked.
Environments: This service can be called from:
Rescheduling: possible. |
|
Unbind from a condition variable. This user-space only service unbinds the calling task from the condition variable object previously retrieved by a call to rt_cond_bind().
Rescheduling: never. |
|
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.
Environments: This service can be called from:
Rescheduling: always unless the request is immediately satisfied or timeout specifies a non-blocking operation.
|