MOD_DEFINE(preempt)
-/** Global preemption disabling nesting counter */
-int _preempt_forbid_cnt;
+/// Global preemption disabling nesting counter
+cpuatomic_t _preempt_forbid_cnt;
static Timer preempt_timer;
INLINE void proc_forbid(void)
{
#if CONFIG_KERN_PREEMPT
- extern int _preempt_forbid_cnt;
+ extern cpuatomic_t _preempt_forbid_cnt;
/*
* We don't need to protect the counter against other processes.
* The reason why is a bit subtle.
* flushed to memory before task switching is re-enabled.
*/
MEMORY_BARRIER;
- extern int _preempt_forbid_cnt;
+ extern cpuatomic_t _preempt_forbid_cnt;
/* No need to protect against interrupts here. */
ASSERT(_preempt_forbid_cnt != 0);
--_preempt_forbid_cnt;
INLINE bool proc_allowed(void)
{
#if CONFIG_KERN_PREEMPT
- extern int _preempt_forbid_cnt;
+ extern cpuatomic_t _preempt_forbid_cnt;
return (_preempt_forbid_cnt == 0);
#else
return true;