diff options
| author | zhkag <[email protected]> | 2023-02-02 10:55:08 +0800 |
|---|---|---|
| committer | guo <[email protected]> | 2023-02-07 13:49:03 +0800 |
| commit | edd9c6721f13bd33d5cc45b18d23bfa7aa607431 (patch) | |
| tree | 78da65ffad96b8658758033f315d95bd94abd8ad /components | |
| parent | 7a1ad00aacbdb3bfc088d2be92b05efd86528fae (diff) | |
add timer lock
Diffstat (limited to 'components')
| -rw-r--r-- | components/libc/compilers/common/ctime.c | 9 |
1 files 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. |
