Xenomai
3.0.5
|
POSIXish condition variable mechanism. More...
Data Structures | |
struct | RT_COND_INFO |
Condition variable status descriptor. More... | |
Functions | |
int | rt_cond_create (RT_COND *cond, const char *name) |
Create a condition variable. More... | |
int | rt_cond_delete (RT_COND *cond) |
Delete a condition variable. More... | |
int | rt_cond_signal (RT_COND *cond) |
Signal a condition variable. More... | |
int | rt_cond_broadcast (RT_COND *cond) |
Broadcast a condition variable. More... | |
int | rt_cond_wait_timed (RT_COND *cond, RT_MUTEX *mutex, const struct timespec *abs_timeout) |
Wait on a condition variable. More... | |
static int | rt_cond_wait_until (RT_COND *cond, RT_MUTEX *mutex, RTIME timeout) |
Wait on a condition variable (with absolute scalar timeout). More... | |
static int | rt_cond_wait (RT_COND *cond, RT_MUTEX *mutex, RTIME timeout) |
Wait on a condition variable (with relative scalar timeout). More... | |
int | rt_cond_inquire (RT_COND *cond, RT_COND_INFO *info) |
Query condition variable status. More... | |
int | rt_cond_bind (RT_COND *cond, const char *name, RTIME timeout) |
Bind to a condition variable. More... | |
int | rt_cond_unbind (RT_COND *cond) |
Unbind from a condition variable. More... | |
POSIXish condition variable mechanism.
A condition variable is a synchronization mechanism which allows tasks to suspend execution until some predicate on some arbitrary 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.
int rt_cond_bind | ( | RT_COND * | cond, |
const char * | name, | ||
RTIME | timeout | ||
) |
Bind to a condition variable.
This routine creates a new descriptor to refer to an existing condition variable identified by its symbolic name. If the object not exist on entry, the caller may block until a condition variable of the given name is created.
cond | The address of a condition variable descriptor filled in by the operation. Contents of this memory is undefined upon failure. |
name | A valid NULL-terminated name which identifies the condition variable to bind to. This string should match the object name argument passed to rt_cond_create(). |
timeout | The number of clock ticks to wait for the registration to occur (see note). Passing TM_INFINITE causes the caller to block indefinitely until the object is registered. Passing TM_NONBLOCK causes the service to return immediately without waiting if the object is not registered on entry. |
int rt_cond_broadcast | ( | RT_COND * | cond | ) |
Broadcast a condition variable.
All tasks currently waiting on the condition variable are immediately unblocked.
cond | The condition variable descriptor. |
int rt_cond_create | ( | RT_COND * | cond, |
const char * | name | ||
) |
Create a condition variable.
Create a synchronization object which allows tasks to suspend execution until some predicate on shared data is satisfied.
cond | The address of a condition variable descriptor which can be later used to identify uniquely the created object, upon success of this call. |
name | An ASCII string standing for the symbolic name of the condition variable. When non-NULL and non-empty, a copy of this string is used for indexing the created condition variable into the object registry. |
int rt_cond_delete | ( | RT_COND * | cond | ) |
Delete a condition variable.
This routine deletes a condition variable object previously created by a call to rt_cond_create().
cond | The condition variable descriptor. |
int rt_cond_inquire | ( | RT_COND * | cond, |
RT_COND_INFO * | info | ||
) |
Query condition variable status.
This routine returns the status information about the specified condition variable.
cond | The condition variable descriptor. |
info | A pointer to the returnbuffer" to copy the information to. |
int rt_cond_signal | ( | RT_COND * | cond | ) |
Signal a condition variable.
If the condition variable cond is pended, this routine immediately unblocks the first waiting task (by queuing priority order).
cond | The condition variable descriptor. |
int rt_cond_unbind | ( | RT_COND * | cond | ) |
Unbind from a condition variable.
cond | The condition variable descriptor. |
This routine releases a previous binding to a condition variable. After this call has returned, the descriptor is no more valid for referencing this object.
|
inlinestatic |
Wait on a condition variable (with relative scalar timeout).
This routine is a variant of rt_cond_wait_timed() accepting a relative timeout specification expressed as a scalar value.
cond | The condition variable descriptor. |
mutex | The address of the mutex serializing the access to the shared data. |
timeout | A delay expressed in clock ticks. |
int rt_cond_wait_timed | ( | RT_COND * | cond, |
RT_MUTEX * | mutex, | ||
const struct timespec * | abs_timeout | ||
) |
Wait on a condition variable.
This service atomically releases the mutex and blocks the calling task, until the condition variable cond is signaled or a timeout occurs, whichever comes first. The mutex is re-acquired before returning from this service.
cond | The condition variable descriptor. |
mutex | The address of the mutex serializing the access to the shared data. |
abs_timeout | An absolute date expressed in clock ticks, specifying a time limit to wait for the condition variable to be signaled (see note). Passing NULL causes the caller to block indefinitely. |
|
inlinestatic |
Wait on a condition variable (with absolute scalar timeout).
This routine is a variant of rt_cond_wait_timed() accepting an abs_timeout specification expressed as a scalar value.
cond | The condition variable descriptor. |
mutex | The address of the mutex serializing the access to the shared data. |
abs_timeout | An absolute date expressed in clock ticks. |