}
#endif
-/** Global preemption disable nesting counter. */
-extern int preempt_forbid_cnt;
-
/**
* Disable preemptive task switching.
*
INLINE void proc_forbid(void)
{
#if CONFIG_KERN_PREEMPT
+ extern int _preempt_forbid_cnt;
// No need to protect against interrupts here.
- ++preempt_forbid_cnt;
+ ++_preempt_forbid_cnt;
/*
- * Make sure preempt_forbid_cnt is flushed to memory so the
+ * Make sure _preempt_forbid_cnt is flushed to memory so the
* preemption softirq will see the correct value from now on.
*/
MEMORY_BARRIER;
* flushed to memory before task switching is re-enabled.
*/
MEMORY_BARRIER;
-
+ extern int _preempt_forbid_cnt;
/* No need to protect against interrupts here. */
- --preempt_forbid_cnt;
- ASSERT(preempt_forbid_cnt >= 0);
+ --_preempt_forbid_cnt;
+ ASSERT(_preempt_forbid_cnt >= 0);
/*
- * This ensures preempt_forbid_cnt is flushed to memory immediately
+ * This ensures _preempt_forbid_cnt is flushed to memory immediately
* so the preemption interrupt sees the correct value.
*/
MEMORY_BARRIER;
#endif
}
+/**
+ * \return true if preemptive task switching is allowed.
+ * \note This accessor is needed because _preempt_forbid_cnt
+ * must be absoultely private.
+ */
+INLINE bool proc_allowed(void)
+{
+ #if CONFIG_KERN_PREEMPT
+ extern int _preempt_forbid_cnt;
+ return (_preempt_forbid_cnt == 0);
+ #else
+ return true;
+ #endif
+}
+
/**
* Execute a block of \a CODE atomically with respect to task scheduling.
*/