[kernel] rearrange the order the critical section count is modified

there was a slight race where the critical section count was bumped but
interrupts had not been disabled yet. Reverse the order of operations
so that at worse interrupts are disabled and the count == 0.
This commit is contained in:
Travis Geiselbrecht
2012-06-27 20:18:39 -07:00
parent 418c8b8baa
commit 18559782b3

View File

@@ -133,9 +133,9 @@ extern int critical_section_count;
static inline __ALWAYS_INLINE void enter_critical_section(void)
{
critical_section_count++;
if (critical_section_count == 1)
if (critical_section_count == 0)
arch_disable_ints();
critical_section_count++;
}
static inline __ALWAYS_INLINE void exit_critical_section(void)