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:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=UDnWT5F3ERICcCWM2XPGQD8t/vqqQHld+H5mE3t0Vy4JspF/LBWHP dGVaxqXPSPITz9EtyNIwpkKkT/JYkCxbG53o3kiymecp2F5+EBJgeOkyoi9LmqGq 4UCtB1KK4orCZ7HgrJ6qFquZu6AHOYC5Ytv9OzMNsTQlJsKXCFsUbc= 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:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=ngEbceT/A+LMxthscR5NaBhP+4A=; b=h5keSxrsq3G+Vm/vG0DZv9cApN44 H8V+//4EY5dol866fTSR86sfSerwggwm1vjR4qvOMKsNZwF+LHH6ldAwQzJKREgw OU5yKdwWIhc+zkNA3h1fiGvDgK+XPRfN9pqDGtvC+Y4rXhKHrgtseqvOjGNzka2I jacvX+zoAMbc/qo= 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=-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 Date: Fri, 12 Jul 2019 17:31:28 +0200 From: Corinna Vinschen To: Kenton Varda Cc: cygwin AT cygwin DOT com Subject: Re: sigpending() incorrectly returns signals pending on other threads Message-ID: <20190712153128.GG3772@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: Kenton Varda , cygwin AT cygwin DOT 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) --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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" -----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--