OSA : OS_Msg_Send_TO

OS_Msg_Send_TO (msg_cb, message, timeout)

Allowed only in taskSwitches contextUses timer

Same as OS_Msg_Send with exit if timeout expires. If timeout expires before msg_cb is free then new message will not be sent.

Call allowed:

Only in task

Parameters:

msg_cb Pointer to message descriptor. Variable of OST_MSG_CB type
message pointer to message body (OST_MSG)
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_MSG_CB msg_cb;
 
void Task (void)
{
    OST_MSG msg;
    static char buf[10];
    for (;;) {
        /*...*/
        OS_Msg_Send_TO (msg_cb, buf, 100);
        if (OS_IsTimeout()) {
            // Message is not sent!
            /*...*/
        }
        /*...*/
    }
}

Old style name

OS_SendMsgTimeout

See also