====== OSA : OS_Squeue_Wait_TO ====== **OS_Squeue_Wait_TO (squeue, os_smsg_type_var, timeout)**\\ === === {{osa:ref:attr_call_task.png|Allowed only in task}}{{osa:ref:attr_call_ct_sw.png|Switches context}}{{osa:ref:attr_call_to.png|Uses timer}} Same as ##[[en:osa:ref:allservices:OS_Squeue_Wait|OS_Squeue_Wait]]## with exit if timeout expires. If timeout expires before message received, then stop waiting with Timeout flag set (see ##[[en:osa:ref:allservices:OS_IsTimeout|OS_IsTimeout]]##) ##[[en:osa:ref:appendix:configuration#System constants|OS_ENABLE_SQUEUE]]## constant must be defined in ##[[en:osa:ref:appendix:configuration|OSAcfg.h]]##. For PIC16, message queues can be allocated only in **bank0** or **bank1** === Call allowed: === Only in task === Parameters: === {| class = "fpl" |- |//''squeue''// |Queue of simple messages descriptor. Variable of ##[[en:osa:ref:description:data_types#OST_SQUEUE|OST_SQUEUE]]## 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_SQUEUE squeue; void Task (void) { OST_SMSG smsg; for (;;) { /*...*/ OS_Squeue_Wait_TO(squeue, smsg, 100); if (!OS_IsTimeout()) { // Simple message received and stored into smsg /*...*/ } /*...*/ } } === Old style name === **OS_WaitQSMsgTimeout**\\ === See also === * [[en:osa:ref:allservices:OS_Squeue_Create|OS_Squeue_Create]] * [[en:osa:ref:allservices:OS_Squeue_Send|OS_Squeue_Send]] * [[en:osa:ref:allservices:OS_Squeue_Send_TO|OS_Squeue_Send_TO]] * [[en:osa:ref:allservices:OS_Squeue_Send_Now|OS_Squeue_Send_Now]] * [[en:osa:ref:allservices:OS_Squeue_Check|OS_Squeue_Check]] * [[en:osa:ref:allservices:OS_Squeue_IsFull|OS_Squeue_IsFull]] * [[en:osa:ref:allservices:OS_Squeue_Wait|OS_Squeue_Wait]] ---- * [[en:osa:ref:services:alphabetical|Alphabetical]] * [[en:osa:ref:services:brieflist|All services]] ~~UP~~