From edd9c6721f13bd33d5cc45b18d23bfa7aa607431 Mon Sep 17 00:00:00 2001 From: zhkag Date: Thu, 2 Feb 2023 10:55:08 +0800 Subject: [PATCH] add timer lock --- components/libc/compilers/common/ctime.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/libc/compilers/common/ctime.c b/components/libc/compilers/common/ctime.c index d457d9f334..dc6e3dd538 100644 --- a/components/libc/compilers/common/ctime.c +++ b/components/libc/compilers/common/ctime.c @@ -921,6 +921,7 @@ static void rtthread_timer_wrapper(void *timerobj) #define TIMER_ID_MAX 50 static struct timer_obj *_g_timerid[TIMER_ID_MAX]; static int timerid_idx = 0; +RT_DEFINE_SPINLOCK(_timer_id_lock); void timer_id_init(void) { @@ -969,14 +970,14 @@ int timer_id_put(int id) _g_timerid[id] = NULL; return 0; } -int timer_id_lock() +void timer_id_lock() { -/* todo */ + rt_hw_spin_lock(&_timer_id_lock); } -int timer_id_unlock() +void timer_id_unlock() { - /* todo */ + rt_hw_spin_unlock(&_timer_id_lock); } /** * @brief Create a per-process timer. -- GitLab