btstack_run_loop_wiced: implement trigger exit

This commit is contained in:
Matthias Ringwald 2021-07-02 16:40:02 +02:00
parent f8d5edf1c3
commit 66c452cf80

View File

@ -65,6 +65,8 @@ static const btstack_run_loop_t btstack_run_loop_wiced;
static wiced_queue_t btstack_run_loop_queue;
// the run loop
static bool run_loop_exit_requested;
static uint32_t btstack_run_loop_wiced_get_time_ms(void){
wiced_time_t time;
wiced_time_get_time(&time);
@ -88,7 +90,7 @@ void btstack_run_loop_wiced_execute_code_on_main_thread(wiced_result_t (*fn)(voi
* Execute run_loop
*/
static void btstack_run_loop_wiced_execute(void) {
while (true) {
while (run_loop_exit_requested == false) {
// process timers
uint32_t now = btstack_run_loop_wiced_get_time_ms();
@ -111,6 +113,11 @@ static void btstack_run_loop_wiced_execute(void) {
}
}
static void btstack_run_loop_wiced_trigger_exit(void){
run_loop_exit_requested = true;
}
static void btstack_run_loop_wiced_btstack_run_loop_init(void){
btstack_run_loop_base_init();
@ -137,4 +144,7 @@ static const btstack_run_loop_t btstack_run_loop_wiced = {
&btstack_run_loop_wiced_execute,
&btstack_run_loop_base_dump_timer,
&btstack_run_loop_wiced_get_time_ms,
NULL, /* poll data sources from irq */
NULL,
btstack_run_loop_wiced_trigger_exit
};