delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/05/05/21:57:32

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Wed, 5 May 2004 21:57:03 -0400
From: Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: pthreads and sockets - Cannot register window class error
Message-ID: <20040506015703.GA22411@coe.bosbc.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <4098760F DOT CDB4F630 AT hot DOT pl> <4098E04B DOT 34D2866B AT dessent DOT net> <20040505210340 DOT GB321 AT coe DOT bosbc DOT com> <Pine DOT LNX DOT 4 DOT 58 DOT 0405051838240 DOT 6708 AT honker DOT vgersoft DOT com> <Pine DOT CYG DOT 4 DOT 58 DOT 0405051858560 DOT 3220 AT fordpc DOT vss DOT fsi DOT com>
Mime-Version: 1.0
In-Reply-To: <Pine.CYG.4.58.0405051858560.3220@fordpc.vss.fsi.com>
User-Agent: Mutt/1.4.1i

On Wed, May 05, 2004 at 07:01:01PM -0500, 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 liar, please at least check the source.  He uses a thread
>specific buffer to return that data.  It's obvious if you look.

It's not actually "me" that does this.  This practice was developed by
the people who took the first stab at making cygwin thread safe.  My
recent signal work did make it a little easier to use thread local
storage however.

cgf

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019