====== OSA : OS_Smsg_Wait_TO ======
**OS_Smsg_Wait_TO (smsg, os_smsg_type_var, timeout)**\\
=== ===
{{osa:ref:attr_call_task.png|Allowed only in task}}
Same as ##[[en:osa:ref:allservices:OS_Smsg_Wait|OS_Smsg_Wait]]##. If timeout expires before message received, then stop waiting with Timeout flag set (see ##[[en:osa:ref:allservices:OS_IsTimeout|OS_IsTimeout]]##)
=== Call allowed: ===
Only in task
=== Parameters: ===
{| class = "fpl"
|-
|//''smsg''//
|Simple message descriptor. Variable of ##[[en:osa:ref:description:data_types#OST_SMSG|OST_SMSG]]## type
|-
|//''os_smsg_type_var''//
|Variable of ##[[en:osa:ref:description:data_types#OST_SMSG|OST_SMSG]]## type, where simple message will be placed
|-
|//''timeout''//
|Time of waiting in system ticks - calling ##[[en:osa:ref:allservices:OS_Timer|OS_Timer]]## periods
|}
=== Returns: ===
{| class = "fpl"
|-
|//''timeout''//
|If timeout expired then system service ##[[en:osa:ref:allservices:OS_IsTimeout|OS_IsTimeout]]## will return **true**
|}
=== Example: ===
OST_SMSG smsg;
void Task (void)
{
OST_SMSG mysmsg;
for (;;) {
/*...*/
OS_Smsg_Wait_TO (smsg, mysmsg, 30); // Wait 30 ticks for simple message
if (!OS_IsTimeout()) {
// Message has been received and stored into mysmsg
/*...*/
}
/*...*/
}
}
=== Old style name ===
**OS_WaitSMsgTimeout**\\
=== See also ===
* [[en:osa:ref:allservices:OS_Smsg_Create|OS_Smsg_Create]]
* [[en:osa:ref:allservices:OS_Smsg_Send|OS_Smsg_Send]]
* [[en:osa:ref:allservices:OS_Smsg_Send_TO|OS_Smsg_Send_TO]]
* [[en:osa:ref:allservices:OS_Smsg_Send_Now|OS_Smsg_Send_Now]]
* [[en:osa:ref:allservices:OS_Smsg_Check|OS_Smsg_Check]]
* [[en:osa:ref:allservices:OS_Smsg_Accept|OS_Smsg_Accept]]
* [[en:osa:ref:allservices:OS_Smsg_Wait|OS_Smsg_Wait]]
----
* [[en:osa:ref:services:alphabetical|Alphabetical]]
* [[en:osa:ref:services:brieflist|All services]]
~~UP~~