From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18549 invoked by alias); 23 Feb 2019 21:50:39 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 18541 invoked by uid 89); 23 Feb 2019 21:50:39 -0000 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 Received: from mail-it1-f196.google.com (HELO mail-it1-f196.google.com) (209.85.166.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 23 Feb 2019 21:50:37 +0000 Received: by mail-it1-f196.google.com with SMTP id v2so2118700ith.3 for ; Sat, 23 Feb 2019 13:50:37 -0800 (PST) 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 22:11:00 -0000 Message-ID: Subject: Re: problem with mmap and fork() To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-02/txt/msg00390.txt.bz2 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