problem with mmap and fork()

Houder houder@xs4all.nl
Mon Feb 25 12:26:00 GMT 2019


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


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list