Are there standard reentrant versions of standard nonreentrant functions?
| Certain standard functions found in C programming environments, | such as gethostbyname, are not reentrant and so are not safe | for use by multithreaded programs. There appear to be two | basic approaches to providing thread-safe versions of these | functions: | | (1) Reimplement the functions to use thread-local storage. | This is the approach that Microsoft has taken. It’s | nice because the interface is exactly the same so you | don’t have to change existing code. Can you cite documentation that Microsoft has done this consistently? (I’d love to be able to rely on it, but haven’t been able to pin this down anywhere.) | (2) Provide alternate reentrant interfaces. This is the | approach taken by (some/most/all?) Unix vendors. The | reentrant version of the function has the same name | as the non-reentrant version plus the suffix _r. For | example, the reentrant version of gethostbyname is | gethostbyname_r. | | The big problem I’m having with approach (2) is that the | reentrant ve
Related Questions
- What if I have multiple versions of the same interface (Ive added new member functions as theyve become necessary), and I want to keep track of which version is implemented by different plugins?
- What are the differences between the Standard, Small Business Professional, and Enterprise versions of CapPlan ?
- Are there standard reentrant versions of standard nonreentrant functions?