From 7a7888227901179597fffc163a23dd15c8d055a9 Mon Sep 17 00:00:00 2001 From: Arto Kinnunen Date: Mon, 25 Feb 2019 15:53:04 +0200 Subject: [PATCH] Squashed 'features/nanostack/sal-stack-nanostack-eventloop/' changes from b8b664b..7745556 7745556 Fix post-event state change for user events git-subtree-dir: features/nanostack/sal-stack-nanostack-eventloop git-subtree-split: 7745556bcce16b50923a7d774a161312418c1e6d --- source/event.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/event.c b/source/event.c index 77dec693c9..337cd14ac4 100644 --- a/source/event.c +++ b/source/event.c @@ -179,23 +179,25 @@ arm_event_storage_t *event_core_get(void) void event_core_free_push(arm_event_storage_t *free) { - free->state = ARM_LIB_EVENT_UNQUEUED; - switch (free->allocator) { case ARM_LIB_EVENT_STARTUP_POOL: + free->state = ARM_LIB_EVENT_UNQUEUED; platform_enter_critical(); ns_list_add_to_start(&free_event_entry, free); platform_exit_critical(); break; case ARM_LIB_EVENT_DYNAMIC: // Free all dynamically allocated events. + // No need to set state to UNQUEUED - it's being freed. ns_dyn_mem_free(free); break; case ARM_LIB_EVENT_TIMER: // Hand it back to the timer system + free->state = ARM_LIB_EVENT_UNQUEUED; timer_sys_event_free(free); break; case ARM_LIB_EVENT_USER: + // No need set state to UNQUEUED - we forget about it. default: break; }