This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pthreads and sockets - Cannot register window class error


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]