From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49858 invoked by alias); 12 Jul 2019 15:31:34 -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 49682 invoked by uid 89); 12 Jul 2019 15:31:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-105.0 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=H*F:D*cygwin.com X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (212.227.17.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Jul 2019 15:31:33 +0000 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MQMdz-1i8Jii1lyL-00MIO7; Fri, 12 Jul 2019 17:31:29 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id B1E86A8075F; Fri, 12 Jul 2019 17:31:28 +0200 (CEST) Date: Fri, 12 Jul 2019 15:31:00 -0000 From: Corinna Vinschen To: Kenton Varda Cc: cygwin@cygwin.com Subject: Re: sigpending() incorrectly returns signals pending on other threads Message-ID: <20190712153128.GG3772@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: Kenton Varda , cygwin@cygwin.com References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-SW-Source: 2019-07/txt/msg00099.txt.bz2 --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1301 On Jul 6 15:46, Kenton Varda wrote: > Hello Cygwin, >=20 > According to the (Linux) man page: "sigpending() returns the set of > signals that are pending for delivery to the calling thread" >=20 > However, on Cygwin, sigpending() seems to return the set of signals > pending on any thread, as shown in the attached test program. >=20 > Among other things, this can cause deadlocks in programs which use > sigpending() to check for pending signals, then use sigsuspend() to > induce delivery of the specific signals that are pending. Because the > signal is not actually pending on the current thread, sigsuspend() > will unexpectedly block, potentially forever. >=20 > Output of test program: > $ uname -srv > CYGWIN_NT-6.1 3.0.7(0.338/5/3) 2019-04-30 18:08 > $ gcc -std=3Dc11 -Wall test-sigpending.c -o test-sigpending -pthread && > ./test-sigpending > sending signal to child thread with pthread_kill()... > sigpending() says signal is pending in main thread (WRONG) > sigpending() says signal is pending in child thread (CORRECT) > received signal in child thread (CORRECT) Thanks for the testcase. This should work now in current git master. I uploaded new developer snapshots to https://cygwin.com/snapshots/ Please give them a try. Thanks, Corinna --=20 Corinna Vinschen Cygwin Maintainer --M9NhX3UHpAaciwkO Content-Type: application/pgp-signature; name="signature.asc" Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl0op9AACgkQ9TYGna5E T6B+HQ/+LT16nUvpAt3zHw7J3rirMtthn9yqWyK/6BFsxvWlWYDyXqzDK6ySybRv aKYa4Ll3A8yZpyniBmuSaKZgj8SkRX79I9jALfENsNQRHxCfVe5a6Z+I2cmnewFi hsbMSEvk4ICKfz61WnykhcGncFMYcwjQAIPyI1mWHsviuF+gmymv47vCHoDSdARv 3MgsnuUKBAy4Xvgj0A+c1ElxLYFhzspFcQRyKVnghU1Ruygn9SpetgqKgofUpi6R hUeaaXgqBQgAG5NP1xHzimgCYO5GjbcEey+VpqeWF7bk8OZDxDeX1zHIsGuKpqj3 EPQ8U0tQqkYT7Ja/pA9qKRVVf6kiAlhueo2FrGpaELrW7dbvDtuKoNARZ/YljyGN AvUPcwvTNHdYbXvr02bbf6HW9yxvjIfgVU7jfHpDcYAzpod1vaxljCDsAATpdLVH q0XFXXHH5jpyjoecUTcuK/YUfJ/Jg+MnB2rLFqXSH5iPi+K+lseZXxyV6zPci+l4 KkoYmPfXATneAWPJlH+EU5Waudjzdc7j/SSpY7e3mIzPFlFrTSiQGijtcQadgxGn q/CK/hCKxoViYds1iSGxUsMtR33FbasWlOr38SUYYK+Gj1du6ue0GwNNjVPrA2SZ 6LhLQ+EtiSQgQyUi6Sruo6q9slVFXQxIH/Y3ZCRvkI5WF177DLE= =/8i5 -----END PGP SIGNATURE----- --M9NhX3UHpAaciwkO--