From: "Berger, Daniel" Date: 2002-06-12T00:52:07+09:00 Subject: RE: hostent extension problem - returning the ip address > -----Original Message----- > From: ts [mailto:decoux@moulon.inra.fr] > Sent: Tuesday, June 11, 2002 10:26 AM > To: ruby-talk@ruby-lang.org > Cc: ruby-talk@ruby-lang.org > Subject: Re: hostent extension problem - returning the ip address > > > >>>>> "S" == Sunblade writes: > > S> Data_Wrap_Struct(cHost,0,host_free,hp); > [...] > S> hp = gethostbyname(h); > S> pptr = hp->h_addr_list; > S> Data_Wrap_Struct(cHost,0,host_free,pptr); /* problem here? */ > > Why do you use Data_Wrap_Struct() ? > > On Solaris 8, for gethostbyname(3) > > The functions gethostbyname(), gethostbyaddr(), and gethos- > tent() use static storage that is reused in each call, mak- > ^^^^^^^^^^^^^^ > ing these functions unsafe for use in multi-threaded appli- > cations. > > > > Guy Decoux I was guessing, actually - I knew that didn't work, I merely put it there as an "alert" of sorts to point you to the area where I'm having trouble. Also, the eventual plan is to use the thread-safe versions provided by individual vendors, e.g. gethostbyname_r() on Solaris. I thought I would start with a basic version and work my way up from there. :) Regards, Dan