From 66c452cf80fc3259c8b47ed58d7d0b925d65da9a Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Fri, 2 Jul 2021 16:40:02 +0200 Subject: [PATCH] btstack_run_loop_wiced: implement trigger exit --- platform/wiced/btstack_run_loop_wiced.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platform/wiced/btstack_run_loop_wiced.c b/platform/wiced/btstack_run_loop_wiced.c index 2c8b6cc17..77e558238 100644 --- a/platform/wiced/btstack_run_loop_wiced.c +++ b/platform/wiced/btstack_run_loop_wiced.c @@ -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 };