OSA : OS_Queue_Wait_TO

OS_Queue_Wait_TO (queue, os_msg_type_var, timeout)

Allowed only in taskSwitches contextUses timer

Same as OS_Queue_Wait. If timeout expires before message received, then stop waiting with Timeout flag set (see OS_IsTimeout)

OS_ENABLE_QUEUE constant must be defined in OSAcfg.h.

For PIC16, message queues can be allocated only in bank0 or bank1

Call allowed:

Only in task

Parameters:

queue Queue of messages descriptor. Variable of OST_QUEUE type.
os_msg_type_var Variable of OST_MSG type, where pointer to message will be placed
timeout Time of waiting in system ticks - calling OS_Timer periods

Returns:

timeout If timeout expired then system service OS_IsTimeout will return true

Example:

OST_QUEUE queue;
 
void Task (void)
{
    OST_MSG msg;
    for (;;) {
        /*...*/
        OS_Queue_Wait_TO (queue, msg, 100);
        if (!OS_IsTimeout()) {
            // Message received and stored into msg
            /*...*/
        }
        /*...*/
    }
}

Old style name

OS_WaitQMsgTimeout

See also