C API condition variable definitions.
More...
C API condition variable definitions.
- For the complete definition, see
- RTOS C++ API
- Examples
int
{
{
}
}
os_result_t os_condvar_signal(os_condvar_t *condvar)
Notify one thread waiting for a condition variable.
void os_condvar_construct(os_condvar_t *condvar, const char *name, const os_condvar_attr_t *attr)
Construct a statically allocated condition variable object instance.
void os_condvar_destruct(os_condvar_t *condvar)
Destruct the statically allocated condition variable object instance.
const char * os_condvar_get_name(os_condvar_t *condvar)
Get the condition variable name.
os_result_t os_condvar_broadcast(os_condvar_t *condvar)
Notify all threads waiting for a condition variable.
int os_main(int argc, char *argv[])
Application entry point, running on the main thread context.
Condition variable object storage.
◆ os_condvar_create
◆ os_condvar_destroy
◆ os_condvar_attr_t
◆ os_condvar_t
Condition variable object storage.
This C structure has the same size as the C++ os::rtos::condition_variable object and must be initialised with os_condvar_create().
Later on a pointer to it can be used both in C and C++ to refer to the timer object instance.
The members of this structure are hidden and should not be used directly, but only through specific functions.
- See also
- os::rtos::condition_variable
◆ os_condvar_attr_init()
Initialise the condition variable attributes.
- Parameters
-
[in] | attr | Pointer to condition variable attributes object instance. |
- Returns
- Nothing.
- Warning
- Cannot be invoked from Interrupt Service Routines.
- For the complete definition, see
- os::rtos::condition_variable::attributes
Definition at line 1772 of file os-c-wrapper.cpp.
◆ os_condvar_broadcast()
Notify all threads waiting for a condition variable.
- Parameters
-
[in] | condvar | Pointer to condition variable object instance. |
- Return values
-
os_ok | All waiting threads signalled. |
EPERM | Cannot be invoked from an Interrupt Service Routines. |
- Errors
- The function shall not fail with an error code of
EINTR
.
- Warning
- Cannot be invoked from Interrupt Service Routines.
- For the complete definition, see
- os::rtos::condition_variable::broadcast()
Definition at line 1891 of file os-c-wrapper.cpp.
◆ os_condvar_construct()
Construct a statically allocated condition variable object instance.
- Parameters
-
[in] | condvar | Pointer to condition variable object instance storage. |
[in] | name | Pointer to name (may be NULL). |
[in] | attr | Pointer to attributes (may be NULL). |
- Errors
- The constructor shall fail if:
EAGAIN
- The system lacked the necessary resources (other than memory) to create the condition variable.
ENOMEM
- Insufficient memory exists to initialise the condition variable.
- The constructor shall not fail with an error code of
EINTR
.
- Returns
- Nothing.
- Note
- Must be paired with
os_condvar_destruct()
.
- Warning
- Cannot be invoked from Interrupt Service Routines.
- For the complete definition, see
- os::rtos::condition_variable
Definition at line 1787 of file os-c-wrapper.cpp.
◆ os_condvar_delete()
Destruct the condition variable object instance and deallocate it.
- Parameters
-
[in] | condvar | Pointer to dynamically allocated condition variable object instance. |
- Returns
- Nothing.
Destruct the condition variable and deallocate the dynamically allocated space using the RTOS system allocator.
- Note
- Equivalent of C++
delete ptr_condvar
.
-
Must be paired with
os_condvar_new()
.
- Warning
- Cannot be invoked from Interrupt Service Routines.
- For the complete definition, see
- os::rtos::condition_variable
Definition at line 1852 of file os-c-wrapper.cpp.
◆ os_condvar_destruct()
Destruct the statically allocated condition variable object instance.
- Parameters
-
[in] | condvar | Pointer to condition variable object instance. |
- Returns
- Nothing.
- Note
- Must be paired with
os_condvar_construct()
.
- Warning
- Cannot be invoked from Interrupt Service Routines.
- For the complete definition, see
- os::rtos::condition_variable
Definition at line 1808 of file os-c-wrapper.cpp.
◆ os_condvar_get_name()
Get the condition variable name.
- Parameters
-
[in] | condvar | Pointer to condition variable object instance. |
- Returns
- Null terminated string.
- Note
- Can be invoked from Interrupt Service Routines.
- For the complete definition, see
- os::rtos::condition_variable::name()
Definition at line 1865 of file os-c-wrapper.cpp.
◆ os_condvar_new()
Allocate a condition variable object instance and construct it.
- Parameters
-
[in] | name | Pointer to name (may be NULL). |
[in] | attr | Pointer to attributes (may be NULL). |
- Errors
- The constructor shall fail if:
EAGAIN
- The system lacked the necessary resources (other than memory) to create the condition variable.
ENOMEM
- Insufficient memory exists to initialise the condition variable.
- The constructor shall not fail with an error code of
EINTR
.
- Returns
- Pointer to new condition variable object instance.
Dynamically allocate the condition variable object instance using the RTOS system allocator and construct it.
- Note
- Equivalent of C++
new condition_variable(...)
.
-
Must be paired with
os_condvar_delete()
.
- Warning
- Cannot be invoked from Interrupt Service Routines.
- For the complete definition, see
- os::rtos::condition_variable
Definition at line 1828 of file os-c-wrapper.cpp.
◆ os_condvar_signal()
Notify one thread waiting for a condition variable.
- Parameters
-
[in] | condvar | Pointer to condition variable object instance. |
- Return values
-
os_ok | The thread was signalled. |
EPERM | Cannot be invoked from an Interrupt Service Routines. |
- Errors
- The function shall not fail with an error code of
EINTR
.
- Warning
- Cannot be invoked from Interrupt Service Routines.
- For the complete definition, see
- os::rtos::condition_variable::signal()
Definition at line 1878 of file os-c-wrapper.cpp.
◆ os_condvar_timed_wait()
Timed wait for a condition variable to be notified.
- Parameters
-
[in] | condvar | Pointer to condition variable object instance. |
[in] | mutex | Pointer to the associated mutex. |
[in] | timeout | Timeout to wait. |
- Return values
-
os_ok | The condition change was signalled. |
EPERM | Cannot be invoked from an Interrupt Service Routines, or the mutex type is mutex::type::errorcheck or the mutex is a robust mutex, and the current thread does not own the mutex. |
ENOTRECOVERABLE | The state protected by the mutex is not recoverable. |
EOWNERDEAD | The mutex is a robust mutex and the process containing the previous owning thread terminated while holding the mutex lock. The mutex lock shall be acquired by the calling thread and it is up to the new owner to make the state consistent. |
ETIMEDOUT | The timeout has passed. |
- Errors
- The function shall not fail with an error code of
EINTR
.
- Warning
- Cannot be invoked from Interrupt Service Routines.
- For the complete definition, see
- os::rtos::condition_variable::timed_wait()
Definition at line 1918 of file os-c-wrapper.cpp.
◆ os_condvar_wait()
Wait for a condition variable to be notified.
- Parameters
-
[in] | condvar | Pointer to condition variable object instance. |
[in] | mutex | Pointer to the associated mutex. |
- Return values
-
os_ok | The condition change was signalled. |
EPERM | Cannot be invoked from an Interrupt Service Routines, or the mutex type is mutex::type::errorcheck or the mutex is a robust mutex, and the current thread does not own the mutex. |
ENOTRECOVERABLE | The state protected by the mutex is not recoverable. |
EOWNERDEAD | The mutex is a robust mutex and the process containing the previous owning thread terminated while holding the mutex lock. The mutex lock shall be acquired by the calling thread and it is up to the new owner to make the state consistent. |
- Errors
- The function shall not fail with an error code of
EINTR
.
- Warning
- Cannot be invoked from Interrupt Service Routines.
- For the complete definition, see
- os::rtos::condition_variable::wait()
Definition at line 1904 of file os-c-wrapper.cpp.