如果使用第三方程序库,事情会变得更为复杂,因为您永远不知道哪部分程序库是可重入的,哪部分是不可重入的。
Things become even more complicated when you're using a third-party library, because you never know which parts of the library are reentrant and which are not.
在大部分系统中,malloc和free都不是可重入的,因为它们使用静态数据结构来记录哪些内存块是空闲的。
On most systems, malloc and free are not reentrant, because they use a static data structure that records which memory blocks are free.
那是因为只有一些系统调用可以安全地调用内部信号:只有可重入的(re -entrant)或者不被信号中断的调用才可以被安全地调用。
That's because only a few system calls can be safely called inside signals. Only calls that are re-entrant or not interruptible by signals can be called safely.
我将提出一个在编译器层次处理可重入函数的模型。
I would like to propose a model for dealing with reentrant functions at the compiler level.
近来很多提供商已经开始提供标准c程序库的可重入版本,这是一个好消息。
The good news is, these days many vendors have taken the initiative to provide reentrant versions of the standard C library.
确保准则3得到满足,要求编译器预先知道所有可重入函数,包括应用程序所使用的程序库。
Ensuring guideline 3 requires the compiler to have prior knowledge of all the reentrant functions, including the libraries used by the application.
定义了可重入性,并包含一个可重入函数的POSIX清单。
Defines reentrancy and includes a POSIX listing of a reentrant function.
通过修改函数的原型,您可以实现这个函数的可重入版本。
You can implement the reentrant version of this function by changing the prototype of the function. This listing provides storage for the output string
理解这五条最好的经验将帮助您保持程序的可重入性。
Sticking to these five best practices will help you maintain reentrancy in your programs.
可重入函数要么使用本地变量,要么在使用全局变量时保护自己的数据。
Reentrant functions either use local variables or protect their data when global variables are used.
由进行调用的函数准备输出存储空间确保了函数的可重入性。
Providing output storage by the calling function ensures the reentrancy of the function.
指出了确保底层函数的可重入性的方法。
Suggests ways to ensure reentrancy of the underlying function.
讨论了在编译器层次上对可重入性的处理。
即使是在目标对象上多次嵌套的同步调用,所持有的可重入锁也会完整的释放。
A full release is obtained even if the lock is re-entrantly held due to nested synchronized calls on the target object.
因此,代码的可重入区域通常必须使用局部变量,也仅以此方式,每个对这些代码的调用才会有独属于自己的一份数据副本。
Thus re-entrant section of code usually must use local variables only in such a way that each and every call to the code gets its own unique copy of data .
因此,代码的可重入区域通常必须使用局部变量,也仅以此方式,每个对这些代码的调用才会有独属于自己的一份数据副本。
Thus re-entrant section of code usually must use local variables only in such a way that each and every call to the code gets its own unique copy of data .
应用推荐