Skip to content

Commit

Permalink
timer: use spin_lock_irqsave protect g_alloctimers
Browse files Browse the repository at this point in the history
all other g_alloctimers being protect by spin_lock_irqsave

Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Apr 10, 2024
1 parent 729e9fc commit be38d08
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sched/timer/timer_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down

0 comments on commit be38d08

Please sign in to comment.