delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/02/23/04:31:24

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:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type; q=dns; s=default; b=y6vy
bFP37GbhdkkOwkpxy4Uz1xGo3B2NJjvyVAQL9VcYQiWTZKW8w8YUM5pwJdbzJ2mG
rEpSo4zpkbGCYpMn+yqEGUauJUBCuYurkQMf3P5N9onmezd0BxveffVPN7uHC8Oi
8S/W2RPxnhxkrs15KfLLX5oSbPdOdPCsQuMpfqo=
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:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type; s=default; bh=XzrBfvELKv
DJef8KpfwoxZiMFgY=; b=BkSqBvCx/Jo+P3Eqk2xSO8D/ylD93S6gJOU/WcyuK3
ej6i3jGD/PBhEO2a3qGWcsNOAYznenID9I/CRfQ9P1ipllzVjYcZ1I5DysT+dtOv
ewxmNh8UufCOd2gq6L5YKjYMOeh5dTKUOMNZCGznovdTNZFzw1nZEYbnSybRTJZ3
w=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=unavailable version=3.3.2 spammy=Hx-languages-length:965, Hx-spam-relays-external:sk:ip-86-4, H*RU:sk:ip-86-4, Glyn
X-HELO: mail-wr1-f45.google.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to; bh=oxpJFHwKu4In6ltqyU11ox9ZpoWaPfXvsXJWZaV8egw=; b=alcUEzGF/gpgVtNAk+HPYEr1ccxAB08YMxugrOVHjKrcwz6rRj95jN2dsMOtXaQxts 1JQrTJof5kWQiwA8u4K64mq8huMjXHtdLjJ15RzXCTuIpsqX2CJhpCP8ZGi4Mv0CtPnd COQ0Z20d2GTgK/W9wuTfM/fEiDh8lj76YpcLrCwfDnc5xBHMArHvhSewOqhapg4a068+ 7s28Z38VMVJcLVhHoupNnuXJiuG4xWrBqseUa52kjvKX3k4uxz57iBRvljzV7BXJ/ZE7 4QjjgiOJ12nOazMB0k1hRliRqbGsoV7F4P2XvyhHiihZdUl8bYL6bNMjBWSNETOyzHbK Oasg==
Subject: Re: problem with mmap and fork()
To: cygwin AT cygwin DOT com
References: <CAAoGPJzdYcCDB=J4ZdfDq1xwLYvZBmT1rC937xHjMd8vseZ-=A AT mail DOT gmail DOT com>
From: =?UTF-8?Q?V=c3=a1clav_Haisman?= <vhaisman AT gmail DOT com>
Openpgp: preference=signencrypt
Message-ID: <d838cf96-ead2-e8cc-d7bb-c8e7df6675a2@gmail.com>
Date: Sat, 23 Feb 2019 10:30:10 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0
MIME-Version: 1.0
In-Reply-To: <CAAoGPJzdYcCDB=J4ZdfDq1xwLYvZBmT1rC937xHjMd8vseZ-=A@mail.gmail.com>
X-IsSubscribed: yes

--eEHNPo1j3z3GjkqscASjJe4pjn6Ubwe7n
Content-Type: multipart/mixed; boundary="yYtiS7cLSv6i2zeWMZZQzX98m5mh4hLAl";
 protected-headers="v1"
From: =?UTF-8?Q?V=c3=a1clav_Haisman?= <vhaisman AT gmail DOT com>
To: cygwin AT cygwin DOT com
Message-ID: <d838cf96-ead2-e8cc-d7bb-c8e7df6675a2 AT gmail DOT com>
Subject: Re: problem with mmap and fork()
References: <CAAoGPJzdYcCDB=J4ZdfDq1xwLYvZBmT1rC937xHjMd8vseZ-=A AT mail DOT gmail DOT com>
In-Reply-To: <CAAoGPJzdYcCDB=J4ZdfDq1xwLYvZBmT1rC937xHjMd8vseZ-=A AT mail DOT gmail DOT com>


--yYtiS7cLSv6i2zeWMZZQzX98m5mh4hLAl
Content-Type: text/plain; charset=utf-8
Content-Language: en-GB
Content-Transfer-Encoding: quoted-printable

On 23. 02. 19 1:02, Glyn Gowing wrote:
> Hello everyone,
>=20
> 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
> Cygwin (downloaded the updates two days ago) and using gcc as the c
> compiler.
>=20
> 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.
>=20
> I've looked at the archives and online and I can't find any hints as
> to what I may be doing incorrectly here
>=20

You cannot fork() and keep using threading primitives in the child. The
child has only one thread and the mutexes are usually in a state that
can be inconsistent. Basically, the only safe thing to do in
multithreaded process after fork is to exec() and reinitialize your
application.

--=20
VH


--yYtiS7cLSv6i2zeWMZZQzX98m5mh4hLAl--

--eEHNPo1j3z3GjkqscASjJe4pjn6Ubwe7n
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQSJLSa55SudhqyrTKZ6WNk3BNXLBgUCXHESqQAKCRB6WNk3BNXL
BrWcAP92IEuBLBDr9NNEyEu6kv7eAYpKsMQYi4irCUHcatg87QD+MXEo8E6gU0K6
BqUlhbxThFst4wScj9d6f2WvWH4HcwA=
=OOuI
-----END PGP SIGNATURE-----

--eEHNPo1j3z3GjkqscASjJe4pjn6Ubwe7n--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019