void thread_2_entry(ULONG thread_input) { ULONG received_message; UINT status; /* This thread retrieves messages placed on the queue by thread 1. */ while(1) { /* Increment the thread counter. */ thread_2_counter++; /* Retrieve a message from the queue. */ status = tx_queue_receive(&queue_0, &received_message, TX_WAIT_FOREVER); /* Check completion status and make sure the message is what we expected. */ if ((status != TX_SUCCESS) || (received_message != thread_2_messages_received)) break; /* Otherwise, all is okay. Increment the received message count. */ thread_2_messages_received++; } }
wwd_result_t host_rtos_pop_from_queue( host_queue_type_t* queue, void* message, uint32_t timeout_ms ) { UINT result = tx_queue_receive( queue, (VOID*)message, ( timeout_ms == NEVER_TIMEOUT ) ? TX_WAIT_FOREVER : (ULONG)( timeout_ms * SYSTICK_FREQUENCY / 1000 ) ); if ( result == TX_SUCCESS ) { return WWD_SUCCESS; } else if ( result == TX_QUEUE_EMPTY ) { return WWD_TIMEOUT; } else if ( result == TX_WAIT_ABORTED ) { return WWD_WAIT_ABORTED; } else { wiced_assert( "queue error ", 0 ); return WWD_QUEUE_ERROR; } }