Web lists-archives.com

Re: problem with mmap and fork()




On Feb 25 11:51, Houder wrote:
> On Sat, 23 Feb 2019 05:54:18, Doug Henderson  wrote:
> 
> > On Fri, 22 Feb 2019 at 17:01, Glyn Gowing <> wrote:
> > > I have a program (attached) that works correctly on my mac but does
> > > not work with Cygwin on Windows 10. I'm running the latest version of
> [snip]
> 
> > On further analysis, the call to
> > > pthread_mutexattr_setpshared(attr, PTHREAD_PROCESS_SHARED);
> > is failing. The error is EINVAL (22) Invalid argument.
> > 
> > This suggests that pthread mutexes cannot be shared between processes
> > by using shared memory in cygwin. I have not attempted to determine if
> > this is working as expected, or if this is a bug, or a limitation in
> > the Windows environment.
> 
> For the record, this (i.c. PTHREAD_PROCESS_SHARED) is not yet supported on
> Cygwin.
> 
> winsup/cygwin/thread.cc
> 
> 3636 extern "C" int
> 3637 pthread_mutexattr_setpshared (pthread_mutexattr_t *attr, int pshared)
> 3638 {
> 3639   if (!pthread_mutexattr::is_good_object (attr))
> 3640     return EINVAL;
> 3641   /* we don't use pshared for anything as yet. We need to test PROCESS_SHARED
> 3642    *functionality
> 3643    */
> 3644   if (pshared != PTHREAD_PROCESS_PRIVATE)
> 3645     return EINVAL; <====
> 3646   (*attr)->pshared = pshared;
> 3647   return 0;
> 3648 }
> 
> Henri

Needless to say that patches in this area are welcome, I guess.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

Attachment: signature.asc
Description: PGP signature