Re: gethostbyname under 10.2
Re: gethostbyname under 10.2
- Subject: Re: gethostbyname under 10.2
- From: Vincent Lubet <email@hidden>
- Date: Tue, 27 Aug 2002 16:09:58 -0700
On Tuesday, August 27, 2002, at 01:36 PM, Jason Linhart wrote:
Both of those routines return a (struct hostent *), which normally
points
to static storage. On every other system, and according to the
implications of the man page, there is only one copy of that structure
that is shared by all calls to both routines from all threads.
In 10.2, each thread got its own hostent buffer.
On all other Unix like systems there are variant routines,
gethostbyname_r and gethostbyaddr_r, which take a pointer to a struct
hostent as an argument (instead of just returning one), that are thread
safe. Neither of these routines are defined in the headers shipped with
10.2.
Feel free to file an enhancement request.
The man page in 10.2 makes no claims of thread safety, instead it
fairly
clearly implies that they are not at all thread safe. It does not make
alot of sense for Apple to have invented their own, incompatible, way
of
making these routines thread safe only to fail to document it.
The man page has not been updated to reflect the new implementation.
The corresponding OT routines are thread safe, but they are still
serialized across all threads in 10.2. If the BSD routines were thread
safe, I would have expected the OT glue routines to have been fixed to
take advantage of that.
It very unlikely to happen because that would only make sense if OT
would spawn a thread for each resolver request.
Vincent
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.