TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Thomas Seeling
from: Mike Bilow
date: 1996-04-11 05:42:28
subject: tcp/ip gethostbyaddr() multithread

Thomas Seeling wrote in a message to All:

 TS> Does anybody know of any problems when using gethostbyaddr()
 TS> of TCP/IP 2.0 (un64092) in multithreaded programs?

 TS> The programmer's reference says that the call returns a
 TS> pointer to static data; this might cause problems when
 TS> multiple calls from different threads come in very quickly
 TS> (500+ threads).

No, you're stuck:


APAR NUMBER: PN47687            RESOLVED AS: DOCUMENTATION ERROR

ABSTRACT:
PN47687: REENTRANT TCPIP PGMR TOOLKIT CALLS FOR V1.2.1 AND V2.0


ORIGINATING DETAILS:
The following TCPIP V1.2.1 and V2.0 Socket calls are NOT
reentrant and calls to these functions need to be serialized:
dn_comp, dn_expand, endhostent, endnetent, endprotoent,
endservent, gethostbyaddr, gethostbyname, gethostent,
getnetbyaddr, getnetbyname, getnetent, getpeername,
getprotobyname, getprotobynumber, getprotoent, getservbyname,
getservbyport, getservent, res_init, res_mkquery, res_send,
sethostent, setnetent, setprotoent, setservent, all ftpapi
calls, and all SNMP DPI calls.
Considering just the 32 bit calls, all the calls in so32dll and
rpc32dll are reentrant, but few if any of the calls in the
other dlls are, giving the list above.

LOCAL FIX AS REPORTED BY ORIGINATOR:
The user must do the serialization, because the appropriate
serialization depends on what the user's code is doing. For
example, if the user is calling getservent, the user should not
issue a call from this family in a different thread, until he
has first issued endservent in the thread that called
getservent. On the other hand, getservbyname is atomic. When it
completes, AND the return information has been copied from the
structure, then it is safe to let other threads issue calls of
this type. RAM semaphores are suggested for serialization, using
DosSemRequest and DosSemRelease.

RESPONDER SUMMARY:
These changes will be incorporated in the next release of the
programmers ref. for TCP/IP for OS/2

RESPONDER CONCLUSION:
See above.


Reported to Correct a PTF in Error:     NO
Reported as a Highly pervasive problem: NO

PE Apar?:       NoPE
Hiper Apar?:    NoHiper
Status:         CLOSED  DOC
Component Name: TCP/IP
Version:        200
Component ID:   562208600
Submitted:      93/10/13
Closed:         93/10/13
ChangeTeam:     RC0120

APAR FIXED BY:  UN57887

 
-- Mike


--- 
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 323/107 170/400 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.