public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* 1.5.9-1: socket() appears NOT to be thread-safe
@ 2004-04-14 10:43 Enzo Michelangeli
  2004-04-14 13:22 ` Corinna Vinschen
  2004-04-14 17:06 ` Brian Ford
  0 siblings, 2 replies; 11+ messages in thread
From: Enzo Michelangeli @ 2004-04-14 10:43 UTC (permalink / raw)
  To: cygwin

While porting to Cygwin the Linux application "sipd"
(http://www.sxdesign.com/index.php?page=developer&submnu=sipd ), which
uses pthreads, I noticed that socket() calls issued concurrently by
several threads often failed, with strerror(errno) saying "operation not
permitted". Once I protected all the calls with mutex locks, such errors
went away. Is Cygwin's implementation of socket() known to be
thread-unsafe?

Enzo

P.S. I have written an implementation of the missing gethostbyname_r(),
based on a mutex-protected call to gethostbyname(). If useful, I may
gladly contribute the code.


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

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: 1.5.9-1: socket() appears NOT to be thread-safe
@ 2004-04-15  4:04 Enzo Michelangeli
  0 siblings, 0 replies; 11+ messages in thread
From: Enzo Michelangeli @ 2004-04-15  4:04 UTC (permalink / raw)
  To: cygwin; +Cc: "Brian Ford"

I wrote:

----- Original Message ----- 
From: "Enzo Michelangeli" <em@em.no-ip.com>
To: <cygwin@cygwin.com>
Cc: ""Brian Ford"" <ford@vss.fsi.com>
Sent: Thursday, April 15, 2004 11:16 AM
Subject: Re: 1.5.9-1: socket() appears NOT to be thread-safe

[...]
> By the way, even in case of no error the socket calls return the same
> value of fd. Is this OK??

Please ignore the two lines above: I forgot to remove them after fixing
the bug that had prompted me to write them in first place :-) The fd are
obviously different, as shown in the sample output.

Enzo

P.S. By the way, Corinna: couldn't I just put my gethostbyname_r() in the
public domain, rather than going through the bureaucratic chore of the
copyright assignment? Also because I feel that implementing it through
mutex-protection of gethostbyname(), as I did, is just a quick hack, as it
unnecessarily blocks other threads that could access the name server in
parallel (with separate network I/O and properly re-entrant code). It may
help other implementors to solve an urgent problem, but I don't think it
should be released as part of the Cygwin code.



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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-06-10 17:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-14 10:43 1.5.9-1: socket() appears NOT to be thread-safe Enzo Michelangeli
2004-04-14 13:22 ` Corinna Vinschen
2004-04-14 17:06 ` Brian Ford
2004-04-15  3:17   ` Enzo Michelangeli
2004-04-15  4:14     ` Christopher Faylor
2004-04-15 17:41       ` Christopher Faylor
2004-05-22 16:59         ` Brian Ford
2004-05-22 19:08           ` Christopher Faylor
2004-06-10 15:21             ` Brian Ford
2004-06-10 17:37               ` Brian Ford
2004-04-15  4:04 Enzo Michelangeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).