今日要點:
- 可再入性及線程互斥的定義
- 疑問代詞(5個)+ever,表示:不論/無論....,都/就...
Reentrant(可再入的)
Said of software that can be executed multiple times simultaneously.(缺乏謂語動詞,并非一句句子,只是對Said說法的解釋而已)
可同時多次運行的程序的說法。
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)鍵在于確保在訪問全局變量或共享寄存器時互斥現(xiàn)象發(fā)生。
key to making code reentrant中的to是介詞而不是動詞不定式,因此后接動詞的話需要加ing,形成動名詞的語法效果。
whenever 關(guān)系介詞,無論任何時候。屬于必須掌握的語法詞之一!
Mutex(互斥)
A data structure for mutual exclusion, also known as a binary semaphore.(同上,并非句子)
表現(xiàn)互斥現(xiàn)象的數(shù)據(jù)結(jié)構(gòu),也被當作二元信號燈。
A mutex is basically just a multitasking-aware binary flag that can be used to synchronize the activities of multiple tasks.
一個互斥基本上是一個多任務(wù)敏感的二元信號,它能用作同步多任務(wù)的行為,
As such, it can be used to protect critical sections of the code from interruption and shared resources from simultaneous use.
它常用作保護從中斷來的臨界段代碼并且在共享同步使用的資源。
- be known as: 被...所知,被稱為,被當作
- be used to do sth: 被用于做...
- to protect...from...:保護...免于遭受...,保護...不受...,其中from具有否定意義,這個句型還是蠻經(jīng)典的,需要牢記一下。
- As such: as such中的such是代詞,指代前面提到的某一名詞或名詞短語,這里當然是指代前面提到的名詞mutex。
一般就翻譯成: 就本身而言,正因為如此之類含義
今日語法小知識:
疑問代詞+ever
1.不論什么.
whatever you say is right.
你不論說什么都是正確的
2.不論怎樣.
however difficult the problom is ,I won't give up.
不論問題再怎么困難,我都不會放棄
3.不論哪個.
whichever you choose,you will die.
不論你選哪個,你都會死掉
4.不論誰.、
I will give it to whomever finish the job.
不論誰完成這個工作,我就給誰
5.不論什么時候.
whenever you come,I will wait for you.
不論你什么時候來,我都會等你