Skip to end of metadata
Go to start of metadata

Description

This function causes the current task to wait for a message to be posted to it.

Files

os.h/os_task.c

Prototype

void  *OSTaskQPend (OS_TICK       timeout,
                    OS_OPT        opt,
                    OS_MSG_SIZE  *p_msg_size,
                    CPU_TS       *p_ts,
                    RTOS_ERR     *p_err)

Arguments

timeout

Optional timeout period (in clock ticks). If non-zero, your task will wait for a message to arrive up to the amount of time specified by this argument. If you specify 0, your task will wait forever, or until a message arrives.

opt

Determines if the user wants to block if the task's queue is empty or not:

OS_OPT_PEND_BLOCKING           Task will block.
OS_OPT_PEND_NON_BLOCKING   Task will NOT block.

p_msg_size

Pointer to a variable that will receive the size of the message.

p_ts

Pointer to a variable that will receive the timestamp of when the message was received. If you pass a NULL pointer (i.e. (CPU_TS *)0), you will not get the timestamp. In other words, passing a NULL pointer is valid and indicates that you don't need the timestamp.

p_err

Pointer to the variable that will receive one of the following error code(s) from this function:

RTOS_ERR_NONE
RTOS_ERR_NOT_FOUND
RTOS_ERR_WOULD_BLOCK
RTOS_ERR_OS_SCHED_LOCKED
RTOS_ERR_ABORT
RTOS_ERR_TIMEOUT

Returned Value

A pointer to the message received or a NULL pointer upon error.

Notes / Warnings

It is possible to receive a NULL pointer when there are no errors.

  • No labels