Re: problem with mmap and fork()
- Date: Sat, 23 Feb 2019 15:50:25 -0600
- From: Glyn Gowing <lzq.maillist@xxxxxxxxx>
- Subject: Re: problem with mmap and fork()
Thanks for confirming for me that cygwin can't do this with fork().
I guess I'll have to warn them about this difference in cygwin. I was
hoping I had made a mistake somewhere.
On Sat, Feb 23, 2019 at 6:54 AM Doug Henderson <djndnbvg@xxxxxxxxx> 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
> > What happens in the buggy execution is that the child obtains a lock
> > before the parent releases it. I'm using mmap and a pthread_mutex_t
> > object along with fork(). Again, this exact code works correctly on my
> > Mac running Mojave.
> 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.
> I have attached my files:
> smtest2.c - my heavily modified version of OP's original.
> smtest2.txt - output from running this version.showing error.
> smtest3.c - my version which uses 2 pthreads in a single process
> smtest3.txt - output from running this version, showing OP's expected results.
> 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
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple