Thread-safety in InetAddress
Status: Beta
Brought to you by:
cierniak
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.