timer: use spin_lock_irqsave protect g_alloctimers

all other g_alloctimers being protect by spin_lock_irqsave

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2023-11-20 13:30:27 +08:00 committed by Xiang Xiao
parent bae686e127
commit 6c24ff95d4

View File

@ -167,11 +167,11 @@ FAR struct posix_timer_s *timer_gethandle(timer_t timerid)
{
FAR struct posix_timer_s *timer = NULL;
FAR sq_entry_t *entry;
irqstate_t intflags;
irqstate_t flags;
if (timerid != NULL)
{
intflags = enter_critical_section();
flags = spin_lock_irqsave(NULL);
sq_for_every(&g_alloctimers, entry)
{
@ -182,7 +182,7 @@ FAR struct posix_timer_s *timer_gethandle(timer_t timerid)
}
}
leave_critical_section(intflags);
spin_unlock_irqrestore(NULL, flags);
}
return timer;