当前位置: 技术问答>linux和unix
什么是“可重入代码”,怎样编写“可重入代码”?
来源: 互联网 发布时间:2014-12-31
本文导语: 什么是“可重入代码”,怎样编写“可重入代码”? “可重入”是什么意思? | My understanding, in brief: Reentrancy is the ability to begin execution of a function while the function is already executing. Buyin...
什么是“可重入代码”,怎样编写“可重入代码”?
“可重入”是什么意思?
“可重入”是什么意思?
|
My understanding, in brief: Reentrancy is the ability to begin execution
of a function while the function is already executing. Buying milk from
the supermarket is reentrant: I don't have to wait for you to finish
buying milk before I do it myself. Using a telephone is not reentrant:
I can't use any telephone on a line you're using until you hang up.
functions must reentrant in a multi-thread application
with more than one program thread. A C-function with
some static local data is not, a C-function that access
some global data is not.
of a function while the function is already executing. Buying milk from
the supermarket is reentrant: I don't have to wait for you to finish
buying milk before I do it myself. Using a telephone is not reentrant:
I can't use any telephone on a line you're using until you hang up.
functions must reentrant in a multi-thread application
with more than one program thread. A C-function with
some static local data is not, a C-function that access
some global data is not.