Menu

#19 Thread-safety in InetAddress

open
nobody
None
5
2001-06-28
2001-06-28
Wu Gansha
No

Native implementation of InetAddress.getByName and
getByAddr need to call gethostbyname/gethostbyaddr,
these two API are not thread-safe in socket lib. Also
getByName and getByAddr are not declared as
synchronized. So we must wrap the call of
gethostbyname/gethostbyaddr in critical section.
See the modification in java_net_InetAddress.cpp.
This file need support of a modified orp_utils.h.
I added two class declarations in it:
CriticalSection as a wrapper of CRITICAL_SECTION to
enable automatic Initialization/DeleteCriticalSection,
and CriticalSectionHelper to enable automatic
Enter/LeaveCriticalSection.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB