void rt_enter_critical(void)
{
register rt_base_t level;
/ disable interrupt */
level = rt_hw_interrupt_disable();
/
the maximal number of nest is RT_UINT16_MAX, which is big
enough and does not check here
/
rt_scheduler_lock_nest ++;
/ enable interrupt */
rt_hw_interrupt_enable(level);
}
#endif /RT_USING_SMP/
RTM_EXPORT(rt_enter_critical);
看了代码, 发现进入临界区的时候, 中断disable然后又enable, 所以, 进入临界区, 只是把所有线程挂起, 但是中断还是可以抢占临界区资源?
更多回帖