今日要點(diǎn):
- 可再入性及線程互斥的定義
- 疑問代詞(5個(gè))+ever发魄,表示:不論/無論....,都/就...
Reentrant(可再入的)
Said of software that can be executed multiple times simultaneously.(缺乏謂語動(dòng)詞铜靶,并非一句句子,只是對(duì)Said說法的解釋而已)
可同時(shí)多次運(yùn)行的程序的說法。
A reentrant function can be safely called recursively or from multiple tasks.
可再入的函數(shù)可以被安全地遞歸調(diào)用或由多任務(wù)多次調(diào)用呐籽。
The key to making code reentrant is to ensure mutual exclusion whenever accessing global variables or shared registers.
使代碼可再入的關(guān)鍵在于確保在訪問全局變量或共享寄存器時(shí)互斥現(xiàn)象發(fā)生盏浇。
key to making code reentrant中的to是介詞而不是動(dòng)詞不定式变丧,因此后接動(dòng)詞的話需要加ing,形成動(dòng)名詞的語法效果绢掰。
whenever 關(guān)系介詞痒蓬,無論任何時(shí)候。屬于必須掌握的語法詞之一滴劲!
Mutex(互斥)
A data structure for mutual exclusion, also known as a binary semaphore.(同上攻晒,并非句子)
表現(xiàn)互斥現(xiàn)象的數(shù)據(jù)結(jié)構(gòu),也被當(dāng)作二元信號(hào)燈班挖。
A mutex is basically just a multitasking-aware binary flag that can be used to synchronize the activities of multiple tasks.
一個(gè)互斥基本上是一個(gè)多任務(wù)敏感的二元信號(hào)鲁捏,它能用作同步多任務(wù)的行為,
As such, it can be used to protect critical sections of the code from interruption and shared resources from simultaneous use.
它常用作保護(hù)從中斷來的臨界段代碼并且在共享同步使用的資源萧芙。
- be known as: 被...所知给梅,被稱為假丧,被當(dāng)作
- be used to do sth: 被用于做...
- to protect...from...:保護(hù)...免于遭受...,保護(hù)...不受...动羽,其中from具有否定意義包帚,這個(gè)句型還是蠻經(jīng)典的,需要牢記一下运吓。
- As such: as such中的such是代詞渴邦,指代前面提到的某一名詞或名詞短語,這里當(dāng)然是指代前面提到的名詞mutex拘哨。
一般就翻譯成: 就本身而言几莽,正因?yàn)槿绱酥惡x
今日語法小知識(shí):
疑問代詞+ever
1.不論什么.
whatever you say is right.
你不論說什么都是正確的
2.不論怎樣.
however difficult the problom is ,I won't give up.
不論問題再怎么困難,我都不會(huì)放棄
3.不論哪個(gè).
whichever you choose,you will die.
不論你選哪個(gè)宅静,你都會(huì)死掉
4.不論誰.章蚣、
I will give it to whomever finish the job.
不論誰完成這個(gè)工作,我就給誰
5.不論什么時(shí)候.
whenever you come,I will wait for you.
不論你什么時(shí)候來姨夹,我都會(huì)等你