uc/os ii 学习笔记 2010-03-19 b

摘抄一段原文:

 

The code for the idle task is shown below. Interrupts are disabled then

enabled around the increment because on 8-bit and most 16-bit processors, a 32-bit increment requires multiple

instructions which must be protected from being accessed by higher priority tasks or an ISR. The idle task can never

be deleted by application software.

void OSTaskIdle (void *pdata)

{

pdata = pdata;

for (;;) {

OS_ENTER_CRITICAL();

OSIdleCtr++;

OS_EXIT_CRITICAL();

}

}

这段论述需要关注一下,在我们c写的一条累加代码可能会是几条汇编才能执行完毕,这之间是可能被中断打断的,所以对一些关键的变量值在改变时要做中端屏蔽,这个在嵌入式开发我想要多注意培养这个意识。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值