distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
Condition Variable C-API

Condition-Variable-related C-API of distortos. More...

Collaboration diagram for Condition Variable C-API:

Classes

struct  distortos_ConditionVariable
 C-API equivalent of distortos::ConditionVariable. More...
 

Macros

#define DISTORTOS_CONDITIONVARIABLE_INITIALIZER(self)   {ESTD_INTRUSIVELIST_INITIALIZER((self).blockedList)}
 Initializer for distortos_ConditionVariable. More...
 
#define DISTORTOS_CONDITIONVARIABLE_CONSTRUCT(name)   struct distortos_ConditionVariable name = DISTORTOS_CONDITIONVARIABLE_INITIALIZER(name)
 C-API equivalent of distortos::ConditionVariable's constructor. More...
 

Functions

int distortos_ConditionVariable_construct (struct distortos_ConditionVariable *conditionVariable)
 C-API equivalent of distortos::ConditionVariable's constructor. More...
 
int distortos_ConditionVariable_destruct (struct distortos_ConditionVariable *conditionVariable)
 C-API equivalent of distortos::ConditionVariable's destructor. More...
 
int distortos_ConditionVariable_notifyAll (struct distortos_ConditionVariable *conditionVariable)
 C-API equivalent of distortos::ConditionVariable::notifyAll() More...
 
int distortos_ConditionVariable_notifyOne (struct distortos_ConditionVariable *conditionVariable)
 C-API equivalent of distortos::ConditionVariable::notifyOne() More...
 
int distortos_ConditionVariable_wait (struct distortos_ConditionVariable *conditionVariable, struct distortos_Mutex *mutex)
 C-API equivalent of distortos::ConditionVariable::wait() More...
 
int distortos_ConditionVariable_waitFor (struct distortos_ConditionVariable *conditionVariable, struct distortos_Mutex *mutex, int64_t duration)
 C-API equivalent of distortos::ConditionVariable::waitFor() More...
 
int distortos_ConditionVariable_waitUntil (struct distortos_ConditionVariable *conditionVariable, struct distortos_Mutex *mutex, int64_t timePoint)
 C-API equivalent of distortos::ConditionVariable::waitUntil() More...
 

Detailed Description

Condition-Variable-related C-API of distortos.

Macro Definition Documentation

◆ DISTORTOS_CONDITIONVARIABLE_CONSTRUCT

#define DISTORTOS_CONDITIONVARIABLE_CONSTRUCT (   name)    struct distortos_ConditionVariable name = DISTORTOS_CONDITIONVARIABLE_INITIALIZER(name)

C-API equivalent of distortos::ConditionVariable's constructor.

See also
distortos::ConditionVariable::ConditionVariable()
Parameters
[in]nameis the name of the object that will be instantiated

◆ DISTORTOS_CONDITIONVARIABLE_INITIALIZER

#define DISTORTOS_CONDITIONVARIABLE_INITIALIZER (   self)    {ESTD_INTRUSIVELIST_INITIALIZER((self).blockedList)}

Initializer for distortos_ConditionVariable.

See also
distortos::ConditionVariable::ConditionVariable()
Parameters
[in]selfis an equivalent of this hidden argument

Function Documentation

◆ distortos_ConditionVariable_construct()

int distortos_ConditionVariable_construct ( struct distortos_ConditionVariable conditionVariable)

C-API equivalent of distortos::ConditionVariable's constructor.

Similar to std::condition_variable::condition_variable() - http://en.cppreference.com/w/cpp/thread/condition_variable/condition_variable Similar to pthread_cond_init() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_init.html

See also
distortos::ConditionVariable::ConditionVariable()
Parameters
[in]conditionVariableis a pointer to distortos_ConditionVariable object
Returns
0 on success, error code otherwise:
  • EINVAL - conditionVariable is invalid;

◆ distortos_ConditionVariable_destruct()

int distortos_ConditionVariable_destruct ( struct distortos_ConditionVariable conditionVariable)

C-API equivalent of distortos::ConditionVariable's destructor.

Similar to std::condition_variable::~condition_variable() - http://en.cppreference.com/w/cpp/thread/condition_variable/~condition_variable Similar to pthread_cond_destroy() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_destroy.html

See also
distortos::ConditionVariable::~ConditionVariable()
Parameters
[in]conditionVariableis a pointer to distortos_ConditionVariable object
Returns
0 on success, error code otherwise:
  • EINVAL - conditionVariable is invalid;
Here is the call graph for this function:

◆ distortos_ConditionVariable_notifyAll()

int distortos_ConditionVariable_notifyAll ( struct distortos_ConditionVariable conditionVariable)

C-API equivalent of distortos::ConditionVariable::notifyAll()

Similar to std::condition_variable::notify_all() - http://en.cppreference.com/w/cpp/thread/condition_variable/notify_all Similar to pthread_cond_broadcast() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_signal.html

See also
distortos::ConditionVariable::notifyAll()
Parameters
[in]conditionVariableis a pointer to distortos_ConditionVariable object
Returns
0 on success, error code otherwise:
  • EINVAL - conditionVariable is invalid;
Here is the call graph for this function:

◆ distortos_ConditionVariable_notifyOne()

int distortos_ConditionVariable_notifyOne ( struct distortos_ConditionVariable conditionVariable)

C-API equivalent of distortos::ConditionVariable::notifyOne()

Similar to std::condition_variable::notify_one() - http://en.cppreference.com/w/cpp/thread/condition_variable/notify_one Similar to pthread_cond_signal() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_signal.html

See also
distortos::ConditionVariable::notifyOne()
Parameters
[in]conditionVariableis a pointer to distortos_ConditionVariable object
Returns
0 on success, error code otherwise:
  • EINVAL - conditionVariable is invalid;
Here is the call graph for this function:

◆ distortos_ConditionVariable_wait()

int distortos_ConditionVariable_wait ( struct distortos_ConditionVariable conditionVariable,
struct distortos_Mutex mutex 
)

C-API equivalent of distortos::ConditionVariable::wait()

Similar to std::condition_variable::wait() - http://en.cppreference.com/w/cpp/thread/condition_variable/wait Similar to pthread_cond_wait() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_wait.html

See also
distortos::ConditionVariable::wait()
Warning
This function must not be called from interrupt context!
Parameters
[in]conditionVariableis a pointer to distortos_ConditionVariable object
[in]mutexis a pointer to mutex which must be owned by calling thread
Returns
0 if the wait was completed successfully, error code otherwise:
  • EINVAL - conditionVariable and/or mutex are invalid;
  • EPERM - the mutex type is errorChecking or recursive, and the current thread does not own the mutex;
Here is the call graph for this function:

◆ distortos_ConditionVariable_waitFor()

int distortos_ConditionVariable_waitFor ( struct distortos_ConditionVariable conditionVariable,
struct distortos_Mutex mutex,
int64_t  duration 
)

C-API equivalent of distortos::ConditionVariable::waitFor()

Similar to std::condition_variable::wait_for() - http://en.cppreference.com/w/cpp/thread/condition_variable/wait_for Similar to pthread_cond_timedwait() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_timedwait.html#

See also
distortos::ConditionVariable::waitFor()
Warning
This function must not be called from interrupt context!
Parameters
[in]conditionVariableis a pointer to distortos_ConditionVariable object
[in]mutexis a pointer to mutex which must be owned by calling thread
[in]durationis the duration after which the wait for notification will be terminated
Returns
0 if the wait was completed successfully, error code otherwise:
  • EINVAL - conditionVariable and/or mutex are invalid;
  • EPERM - the mutex type is errorChecking or recursive, and the current thread does not own the mutex;
  • ETIMEDOUT - no notification was received before the specified timeout expired;
Here is the call graph for this function:

◆ distortos_ConditionVariable_waitUntil()

int distortos_ConditionVariable_waitUntil ( struct distortos_ConditionVariable conditionVariable,
struct distortos_Mutex mutex,
int64_t  timePoint 
)

C-API equivalent of distortos::ConditionVariable::waitUntil()

Similar to std::condition_variable::wait_until() - http://en.cppreference.com/w/cpp/thread/condition_variable/wait_until Similar to pthread_cond_timedwait() - http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_timedwait.html#

See also
distortos::ConditionVariable::waitUntil()
Warning
This function must not be called from interrupt context!
Parameters
[in]conditionVariableis a pointer to distortos_ConditionVariable object
[in]mutexis a pointer to mutex which must be owned by calling thread
[in]timePointis the time point at which the wait for notification will be terminated
Returns
0 if the wait was completed successfully, error code otherwise:
  • EINVAL - conditionVariable and/or mutex are invalid;
  • EPERM - the mutex type is errorChecking or recursive, and the current thread does not own the mutex;
  • ETIMEDOUT - no notification was received before the specified timeout expired;
Here is the call graph for this function: