Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Are there standard reentrant versions of standard nonreentrant functions?

0
Posted

Are there standard reentrant versions of standard nonreentrant functions?

0

| 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 is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123