diff --git a/src/mempool.c b/src/mempool.c index 3992a85219..4fdba42715 100644 --- a/src/mempool.c +++ b/src/mempool.c @@ -16,6 +16,7 @@ * 2012-03-22 Bernard fix align issue in rt_mp_init and rt_mp_create. * 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to mempool.c * 2023-09-15 xqyjlj perf rt_hw_interrupt_disable/enable + * 2023-12-10 xqyjlj fix spinlock assert */ #include @@ -290,12 +291,13 @@ rt_err_t rt_mp_delete(rt_mp_t mp) rt_thread_resume(thread); } + rt_spin_unlock_irqrestore(&(mp->spinlock), level); + /* release allocated room */ rt_free(mp->start_address); /* detach object */ rt_object_delete(&(mp->parent)); - rt_spin_unlock_irqrestore(&(mp->spinlock), level); return RT_EOK; }