开发者

POSIX reentrant functions

Is there a POSIX function equivalent to _malloc_r and _free_r from CYG开发者_StackOverflow中文版WIN? Is there a POSIX reentrant library?

Please advice.

Many thanks.


No, and for good reason. Demanding reentrancy of malloc, even if only for special _r functions, would impose massive performance costs and likely precludes many high-performance implementations to begin with. Why do you need reentrancy? If you're trying to allocate memory from a signal handler, you might use mmap, but a better approach would be moving as much code as possible out of the signal handler and using the signal handler itself only to set a flag that will get picked up by another part of your program after the signal handler returns.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜