Description
Aborts and readies any tasks currently waiting on a message queue. This function should be used to fault-abort the wait on the message queue, rather than to signal the message queue via OSQPost()
.
Files
os.h/os_q.c
Prototype
Code Block |
---|
OS_OBJ_QTY OSQPendAbort (OS_Q *p_q, |
...
OS_OPT opt, |
...
OS_ERR *p_err) |
...
File
...
Called from
...
Code enabled by
...
os_q.c
...
...
OS_CFG_Q_EN
and OS_CFG_Q_PEND_ABORT_EN
OSQPendAbort()
aborts and readies any tasks currently waiting on a message queue. This function should be used to fault-abort the wait on the message queue, rather than to signal the message queue via OSQPost()
.
Arguments
p_q
is a pointer to the queue for which pend(s) need to be aborted.
...
at least one task waiting on the message queue was readied and informed of the aborted wait. Check the return value for the number of tasks whose wait on the message queue was aborted.
OS_ERR_PENDOBJ_ABORTPTR_ISRNULL
If OS_CFG_CALLEDARG_FROM_ISR_CHK_EN
is set to 1
in DEF_ENABLED
in os_cfg.h
: if called from an ISR p_q
is a NULL
pointer.
OS_ERR_PENDOBJ_ABORT_NONE
...
TYPE
If OS_CFG_OBJ_TYPE_CHK_EN
is set to DEF_ENABLED
in os_cfg.h
: if p_q
is not pointing to a message queue.
OS_ERR_OBJOPT_PTR_NULLINVALID
If If OS_CFG_ARG_CHK_EN
is set to 1
in is set to DEF_ENABLED
in os_cfg.h
: if p_q
is a NULL
pointera valid option is not specified.
OS_ERR_OS_OBJNOT_TYPERUNNING
If If OS_CFG_OBJINVALID_OS_TYPECALLS_CHK_EN
is set to 1
in is set to DEF_ENABLED
in os_cfg.h
: if p_q
is not pointing to a message queueif µC/OS-III is not running yet.
OS_ERR_PEND_OPTABORT_INVALIDISR
If If OS_CFG_ARGCALLED_FROM_ISR_CHK_EN
is set to 1
in set to DEF_ENABLED
in os_cfg.h
: if an invalid option is specified.called from an ISR
OS_ERR_PEND_ABORT_NONE
If no task was pending on the message queue
Returned Value
OSQPendAbort()
returns the number of tasks made ready-to-run by this function. Zero indicates that no tasks were pending on the message queue, therefore this function had no effector an error.
Required Configuration
OS_CFG_Q_EN
and OS_CFG_Q_PEND_ABORT_EN
must be enabled in os_cfg.h
. Refer to µC-OS-III Configuration Manual.
Callers
Application.
Notes/Warnings
- Queues must be created before they are used.
Example Usage
Code Block | ||
---|---|---|
| ||
OS_Q CommQ;
void CommTask(void *p_arg)
{
OS_ERR err;
OS_OBJ_QTY nbr_tasks;
(void)&p_arg;
while (DEF_ON) {
:
:
nbr_tasks = OSQPendAbort(&CommQ,
OS_OPT_PEND_ABORT_ALL,
&err);
/* Check "err" */
:
:
}
} |