QP/C  5.8.2
qf_defer.c File Reference

QActive_defer() and QActive_recall() implementation. More...

#include "qf_port.h"
#include "qf_pkg.h"
#include "qassert.h"

Go to the source code of this file.

Macros

#define QP_IMPL   /* this is QP implementation */
 

Functions

bool QActive_defer (QActive const *const me, QEQueue *const eq, QEvt const *const e)
 Defer an event e to a given event queue eq. More...
 
bool QActive_recall (QActive *const me, QEQueue *const eq)
 Recall a deferred event from a given event queue eq. More...
 
uint_fast16_t QActive_flushDeferred (QActive const *const me, QEQueue *const eq)
 Flush the specified deferred queue eq. More...
 

Detailed Description

QActive_defer() and QActive_recall() implementation.

Definition in file qf_defer.c.

Function Documentation

◆ QActive_defer()

bool QActive_defer ( QActive const *const  me,
QEQueue *const  eq,
QEvt const *const  e 
)

Defer an event e to a given event queue eq.

Description
This function is part of the event deferral support. An active object uses this function to defer an event e to the QF-supported native event queue eq. QF correctly accounts for another outstanding reference to the event and will not recycle the event at the end of the RTC step. Later, the active object might recall one event at a time from the event queue.
Parameters
[in,out]mepointer (see Object Orientation)
[in]eqpointer to a "raw" thread-safe queue to recall an event from.
[in]epointer to the event to be deferred
Returns
'true' (success) when the event could be deferred and 'false' (failure) if event deferral failed due to overflowing the queue.

An active object can use multiple event queues to defer events of different kinds.

See also
QActive_recall(), QEQueue, QActive_flushDeferred()

Definition at line 70 of file qf_defer.c.

◆ QActive_flushDeferred()

uint_fast16_t QActive_flushDeferred ( QActive const *const  me,
QEQueue *const  eq 
)

Flush the specified deferred queue eq.

Description
This function is part of the event deferral support. An active object can use this function to flush a given QF event queue. The function makes sure that the events are not leaked.
Parameters
[in,out]mepointer (see Object Orientation)
[in]eqpointer to a "raw" thread-safe queue to flush.
Returns
the number of events actually flushed from the queue.
See also
QActive_defer(), QActive_recall(), QEQueue

Definition at line 149 of file qf_defer.c.

◆ QActive_recall()

bool QActive_recall ( QActive *const  me,
QEQueue *const  eq 
)

Recall a deferred event from a given event queue eq.

Description
This function is part of the event deferral support. An active object uses this function to recall a deferred event from a given QF event queue. Recalling an event means that it is removed from the deferred event queue eq and posted (LIFO) to the event queue of the active object.
Parameters
[in,out]mepointer (see Object Orientation)
[in]eqpointer to a "raw" thread-safe queue to recall an event from.
Returns
'true' if an event has been recalled and 'false' if not.
Note
An active object can use multiple event queues to defer events of different kinds.
See also
QActive_recall(), QEQueue, QActive_postLIFO_()

Definition at line 98 of file qf_defer.c.