From 4d4d09ec74e719ef4cf8ad7303e2cca6a95d05de Mon Sep 17 00:00:00 2001 From: Peter Harper Date: Wed, 27 Nov 2024 12:55:43 +0000 Subject: [PATCH] Initialise stack in async_context_execute_sync call We need to do this to avoid work_pending being set twice. Fixes #2101 --- src/rp2_common/pico_async_context/async_context_freertos.c | 2 +- .../pico_async_context/async_context_threadsafe_background.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rp2_common/pico_async_context/async_context_freertos.c b/src/rp2_common/pico_async_context/async_context_freertos.c index 3cffcbb98..9ae72b3af 100644 --- a/src/rp2_common/pico_async_context/async_context_freertos.c +++ b/src/rp2_common/pico_async_context/async_context_freertos.c @@ -193,7 +193,7 @@ static void handle_sync_func_call(async_context_t *context, async_when_pending_w uint32_t async_context_freertos_execute_sync(async_context_t *self_base, uint32_t (*func)(void *param), void *param) { async_context_freertos_t *self = (async_context_freertos_t*)self_base; hard_assert(xSemaphoreGetMutexHolder(self->lock_mutex) != xTaskGetCurrentTaskHandle()); - sync_func_call_t call; + sync_func_call_t call = {0}; call.worker.do_work = handle_sync_func_call; call.func = func; call.param = param; diff --git a/src/rp2_common/pico_async_context/async_context_threadsafe_background.c b/src/rp2_common/pico_async_context/async_context_threadsafe_background.c index 33f3d45c8..730d8a5a7 100644 --- a/src/rp2_common/pico_async_context/async_context_threadsafe_background.c +++ b/src/rp2_common/pico_async_context/async_context_threadsafe_background.c @@ -140,7 +140,7 @@ uint32_t async_context_threadsafe_background_execute_sync(async_context_t *self_ #if ASYNC_CONTEXT_THREADSAFE_BACKGROUND_MULTI_CORE if (self_base->core_num != get_core_num()) { hard_assert(!recursive_mutex_enter_count(&self->lock_mutex)); - sync_func_call_t call; + sync_func_call_t call = {0}; call.worker.do_work = handle_sync_func_call; call.func = func; call.param = param;