X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; q=dns; s=default; b=cWd70OA pMEbjPgpE+wwYiI6IINr+ErkgW4xd4JuGPiEYuk/34dRLT2th+I+Tl10C9pWloLV ne62zJ9/G6JnQ4ts1yb9Ec2nB1RkrE5RzT2t1ZD9m1TMaVOrDjuQXVPa5Iq2CgHp zy3vaw1uTb/PbsyxBA64dtj52Z95xg3qjfCI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; s=default; bh=xuW4XS3PIQ3sl F0rlHc6ebqdnIY=; b=lS4hrB40B4gkUYtjUYMY9ie+oBS51SoM6CdzHkQS3Le3o c3y/XHy43hWd+iEfyn78plg9s2xPRrDSDBah3jOk4iXW0Kotkb1n7fl7+luH/qki N1hmm5Ikx6EluuOHBkf8UFtDr5KmBxcIUKlbKQkJ6JGO5cDlB8J29J3aHtiSXk= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=BAYES_05,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=henderson, Henderson, Glyn, mutexes X-HELO: mail-it1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=8QCwbjA87Gk0Wlp/NzLQgaZWmjI2Z1xQ8+DqNo8XZz0=; b=DksdIFXzuXqdepNNg+L8xbIYMiwARfLsfisw5TypWpoSBtPwNKLpRxx+/O6xjc6QZW N7LaP8G6P20Xt+4PqC36qjOGUvuiWKV57Mv7uPUmhjGF0CeM7mQbFBvT/pNmbJeB34ac X5B6spo5yr/UIFp2F4/GvoNvudLjbgNA0YKSNmY5E6J9/GCwzG6HL5IBO9RglHM5UW+a g28H2nXeb1Sjw7cNcTjUzR+UVDLJoA2h47kbfpBq9v4gXrlhxYXToi0gz9TwwzeU1SEO iRMr/QZD9PRQ0ANTxxBrcUEqgjQdHHeC34Gs5ELelIxxQmWGQzmJNuN0L8DfWFZvcnkB ZZ8g== MIME-Version: 1.0 References: In-Reply-To: From: Glyn Gowing Date: Sat, 23 Feb 2019 15:50:25 -0600 Message-ID: Subject: Re: problem with mmap and fork() To: cygwin AT cygwin DOT com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes 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 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. > > HTH > Doug > > -- > 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 FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple