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: 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=-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: From: =?UTF-8?Q?V=c3=a1clav_Haisman?= Openpgp: preference=signencrypt Message-ID: 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: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="eEHNPo1j3z3GjkqscASjJe4pjn6Ubwe7n" X-IsSubscribed: yes --eEHNPo1j3z3GjkqscASjJe4pjn6Ubwe7n Content-Type: multipart/mixed; boundary="yYtiS7cLSv6i2zeWMZZQzX98m5mh4hLAl"; protected-headers="v1" From: =?UTF-8?Q?V=c3=a1clav_Haisman?= To: cygwin AT cygwin DOT com Message-ID: Subject: Re: problem with mmap and fork() References: In-Reply-To: --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--