rt_enter_critical()
/*
* critical region
*/
rt_exit_critical()
File: scheduler.c
rt_enter_critical| 功能 | 回傳值 |
|---|---|
| 進入 scheuler 鎖 | void |
/**
* This function will lock the thread scheduler.
*/
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);
}
RTM_EXPORT(rt_enter_critical);
rt_scheduler_lock_nest 加一rt_exit_critical| 功能 | 回傳值 |
|---|---|
| 離開 scheuler 鎖 | void |
/**
* This function will unlock the thread scheduler.
*/
void rt_exit_critical(void)
{
register rt_base_t level;
/* disable interrupt */
level = rt_hw_interrupt_disable();
rt_scheduler_lock_nest --;
rt_scheduler_lock_nest 減一
if (rt_scheduler_lock_nest <= 0)
{
rt_scheduler_lock_nest = 0;
/* enable interrupt */
rt_hw_interrupt_enable(level);
rt_schedule();
}
else
{
/* enable interrupt */
rt_hw_interrupt_enable(level);
}
}
rt_scheduler_lock_nest 被減至 0 或以下,進行一次調度rt_critical_level| 功能 | 回傳值 |
|---|---|
| 回傳 scheuler 鎖的值 | scheuler 鎖的值 |
/**
* Get the scheduler lock level
*
* @return the level of the scheduler lock. 0 means unlocked.
*/
rt_uint16_t rt_critical_level(void)
{
return rt_scheduler_lock_nest;
}
RTM_EXPORT(rt_critical_level);
rt_scheduler_lock_nest 值RT-Thread kernel ipc首頁
Sep 30, 2024Thread Thread Create st=>start: start 1 e=>end: end e1=>end: return init=>condition: init attribute stk_sz=>operation: Set Stack Size chk_poli=>condition: FIFO or
Aug 16, 202313.1 多變數函數 $$ \begin{split} z &=& f(x,y)\ D &=& {(x,y)|x,y\in \mathbb{R}}\ R &=& {z|z\in f(x,y)} \end{split} $$ $D$:定義域(domin),注意分母不為 $0$、根號裡面 $\ge0$
Apr 23, 2022使用此管理方式: #define RT_USING_MEMPOOL
Apr 23, 2022or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up