Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Wed, 5 May 2004 20:30:16 -0400 (EDT)
From: Steve Thompson <smt@vgersoft.com>
Reply-To: smt@vgersoft.com
To: cygwin@cygwin.com
Subject: Re: pthreads and sockets - Cannot register window class error
In-Reply-To: <Pine.CYG.4.58.0405051858560.3220@fordpc.vss.fsi.com>
Message-ID: <Pine.LNX.4.58.0405052025540.29120@honker.vgersoft.com>
References: <4098760F.CDB4F630@hot.pl> <4098E04B.34D2866B@dessent.net> <20040505210340.GB321@coe.bosbc.com> <Pine.LNX.4.58.0405051838240.6708@honker.vgersoft.com> <Pine.CYG.4.58.0405051858560.3220@fordpc.vss.fsi.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Wed, 5 May 2004, Brian Ford wrote:

> On Wed, 5 May 2004, Steve Thompson wrote:
>
> > On Wed, 5 May 2004, Christopher Faylor wrote:
> >
> > > Unless HOST is a numeric IP address, gethostbyname should be properly
> > > reentrant.  The only time gethostbyname is not thread safe is when it is
> > > resolving a numeric IP.
> >
> > I believe that gethostbyname(), since it is returning a pointer to a
> > statically allocated structure, cannot be thread safe under any
> > circumstances. I always wrap it with a mutex until I'm done with the
> > hostent structure.
>
> That's a good portable practice.  But, if your going to essentially call
> cgf a lyer, please at least check the source.  He uses a thread specific
> buffer to return that data.  It's obvious if you look.

Heaven forbid that I should do that; it certainly wasn't my meaning.
Apologies to cgf if it was taken that way. In any event, relying on a
feature that is particular to one implementation will always bite you in
the end.

Steve

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

