mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
nuttx/sched: Replace irqsave() with enter_critical_section(); replace irqrestore() with leave_critical_section()
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* 2. Redistributions i, 2016n binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <queue.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
||||
#include "timer/timer.h"
|
||||
@@ -68,7 +69,7 @@ static inline void timer_free(struct posix_timer_s *timer)
|
||||
|
||||
/* Remove the timer from the allocated list */
|
||||
|
||||
flags = irqsave();
|
||||
flags = enter_critical_section();
|
||||
sq_rem((FAR sq_entry_t *)timer, (FAR sq_queue_t *)&g_alloctimers);
|
||||
|
||||
/* Return it to the free list if it is one of the preallocated timers */
|
||||
@@ -77,14 +78,14 @@ static inline void timer_free(struct posix_timer_s *timer)
|
||||
if ((timer->pt_flags & PT_FLAGS_PREALLOCATED) != 0)
|
||||
{
|
||||
sq_addlast((FAR sq_entry_t *)timer, (FAR sq_queue_t *)&g_freetimers);
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* Otherwise, return it to the heap */
|
||||
|
||||
irqrestore(flags);
|
||||
leave_critical_section(flags);
|
||||
sched_kfree(timer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user