How to insure the timer is thread-safe

lv_timer_handler is called in thread A. lv_timer_del is called in thread B.

what does it happened that lv_mem_free(timer) is executed during executing lv_timer_exec.

Thanks.

LVGL assumes that all functions (except lv_tick_inc) are always called in a “single-threaded” context. Essentially, the assumption is that two API functions never execute concurrently. You need to use a mutex to ensure that this is always the case.

Got it. Thanks for your reply