this is solved by one of two methods:
   1-) require the caller of gethostbyaddr() to supply a pointer to
       a hostent struct which will be filled.
or 2-) the library uses thread specific storage which is re-used in
       each call.


>From: Joe Groff <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>CC: [EMAIL PROTECTED], [EMAIL PROTECTED]
>Subject: Re: gethostbyaddr() and threads.
>Date: Mon, 9 Aug 1999 14:21:38 -0700 (PDT)
>MIME-Version: 1.0
>From [EMAIL PROTECTED] Mon Aug  9 14:22:43 1999
>Received: by hub.freebsd.org (Postfix, from userid 538)id 13F1E152DC; Mon,  
>9 Aug 1999 14:24:36 -0700 (PDT)
>Received: from localhost (localhost [127.0.0.1])by hub.freebsd.org 
>(Postfix) with SMTPid F31551CD65D; Mon,  9 Aug 1999 14:24:35 -0700 
>(PDT)(envelope-from owner-freebsd-hackers)
>Received: by hub.freebsd.org (bulk_mailer v1.12); Mon, 9 Aug 1999 14:24:35 
>-0700
>Delivered-To: [EMAIL PROTECTED]
>Received: from home.humboldt1.com (home.humboldt1.com [206.13.45.1])by 
>hub.freebsd.org (Postfix) with ESMTP id 9598214D75for 
><[EMAIL PROTECTED]>; Mon,  9 Aug 1999 14:24:29 -0700 (PDT)(envelope-from 
>[EMAIL PROTECTED])
>Received: from shovel.groff (ppp176-pm5.humboldt1.com [207.104.21.169])by 
>home.humboldt1.com (Pro-8.9.2/Pro-8.9.2) with SMTP id OAA21266;Mon, 9 Aug 
>1999 14:21:38 -0700 (PDT)
>Message-Id: <[EMAIL PROTECTED]>
>In-Reply-To: <[EMAIL PROTECTED]>
>X-Mailer: XCmail 1.0.0 - with PGP support, PGP engine version 0.5 (FreeBSD)
>X-Mailerorigin: http://www.fsai.fh-trier.de/~schmitzj/Xclasses/XCmail/
>Sender: [EMAIL PROTECTED]
>X-Loop: FreeBSD.ORG
>Precedence: bulk
>
>---Brian McGovern said:
> > [snip]
> >
> > gethostbyaddr... actually, most of the gethostby* functions... are not
> > thread safe. They all use a static buffer in the library.
> >
> > Therefore, with threads, if you don't take precautions, I'd expect your
> > results to be odd.
> >     -Brian
> >
>Couldn't this be easily fixed? I haven't looked at the source yet, but I
>believe you could replaced the static buffers with a dynamically-allocated 
>list
>of buffers, with one for each thread using the gethost functions. Or 
>perhaps
>you could just eliminate all the static stuff altogether?
>
>-Joe
>
>
>
>
>To Unsubscribe: send mail to [EMAIL PROTECTED]
>with "unsubscribe freebsd-hackers" in the body of the message
>


_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to