httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <>
Subject Re: [PATCH] 1.3: changing accept mutex for Cygwin
Date Thu, 17 Jan 2002 15:30:55 GMT
Jeff Trawick <> writes:

> Jim Jagielski <> writes:
> > >diff -ur apache-1.3/src/main/http_main.c apache-1.3-cygwin/src/main/http_main.c
> > >--- apache-1.3/src/main/http_main.c	Wed Oct 17 14:45:30 2001
> > >+++ apache-1.3-cygwin/src/main/http_main.c	Tue Jan  1 16:05:19 2002
> > >@@ -662,11 +662,17 @@
> > > 	perror("pthread_mutexattr_init");
> > > 	exit(APEXIT_INIT);
> > >     }
> > >X-Mozilla-Status: 8009n has problems with this pthread call claiming that these
> > >+     * are "Invalid arguements", Stipe Tolj <>
> > >+     */
> > >+#if !defined(CYGWIN)
> > >     if ((errno = pthread_mutexattr_setpshared(&mattr,
> > > 	perror("pthread_mutexattr_setpshared");
> > > 	exit(APEXIT_INIT);
> > >     }
> > >+#endif
> > 
> > This looks mangled though :) :)
> manglement aside, I'm -1 without an answer to the question on this
> code which I posted previously...  
> the answer may simply be
> "with Cygwin, all pthread mutexes are cross-process, so there is no
> need for such a call"
> Since on other systems pthread mutexes are intra-process without
> such a call, I can't help but wonder.

Let me clarify my concern, in case somebody can find a flaw in my
logic or in case it helps Stipe know what I would like him to verify
(and document in comments).

base facts/assumptions:

1) pthread mutexes are normally intra process, but if the following
   conditions are met, pthread mutexes can be used cross-process

   a) the mutex itself lives in shared memory which is addressible by
      the processes which need to serialize via the mutex

   b) the pthread_mutexattr_setpshared(,PTHREAD_PROCESS_SHARED) call
      is used to tell the pthreads library that the mutex is

2) not all systems which support pthread mutexes have the support to
   make them work cross-process; such systems either neglect to define
   PTHREAD_PROCESS_SHARED or return an error from

3) Cygwin always returns an error from

4) it is possible for Apache to appear to work correctly without
   proper accept serialization

My conclusion from these facts/assumptions is that with Stipe's change
he is falling into #4 above.  In other words, he isn't getting working
accept serialization.  If that is true, I would prefer that for Cygwin
we (Stipe) set whatever is required so that we don't try to do accept
serialization at all, rather than using the pthread mutex support in a
non-working manner.

I accept that Cygwin may have certain nuances/deviations that result
in Stipe's code to be appropriate (perhaps on Cygwin all pthread
mutexes are cross-process and returning an error from
pthread_mutexattr_setpshared() is Cygwin's way of telling you that the
call is unnecessary), but I would like to see such nuances spelled out
in comments adjacent to "#if !defined(CYGWIN)".  As it stands, the
code looks broken.

I suspect that deep knowledge of Cygwin pthread mutex support (i.e.,
communication with one of the developers or examining the source) is
necessary to address the concern.  If it is unclear why
pthread_mutexattr_setpshared() returns EINVAL then probably we don't
have the information to know why skipping that call is appropriate.
Jeff Trawick | | PGP public key at web site:
             Born in Roswell... married an alien...

View raw message