| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 0945638582A1 |
| DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
| s=default; t=1705915583; | |
| bh=3OQ90oou0IvmhCnIFcZvSbfvEkZ4A6lPj3XnAX/H2ss=; | |
| h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: | |
| List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: | |
| From; | |
| b=wYnoB7UL4dxYxUUTYwyTa4AtiflohiBuc+hR5EG0P9NSfPxnQ1leXzwh9Kcr8nbiO | |
| bTn1WmoMmQGGKKRzj56dzl19cqbOoJzJ18xarxp5wStBjItHa9I1pn3smQijm5yjk5 | |
| cAYbl8kuY/aGKEle+aQvibeKwrVB2Hayy82Wxtvg= | |
| X-Original-To: | cygwin AT cygwin DOT com |
| Delivered-To: | cygwin AT cygwin DOT com |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 9382C3858C2F |
| Date: | Mon, 22 Jan 2024 10:25:28 +0100 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Possiblly bug of cygwin1.dll |
| Message-ID: | <Za40iEPcedfBSt5n@calimero.vinschen.de> |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| References: | <20240119224436 DOT 876a055f356f7c6796bc725b AT nifty DOT ne DOT jp> |
| <ZaqHGElhXZIc3NFX AT calimero DOT vinschen DOT de> | |
| <20240120131825 DOT 4157c259fe058155137d6fe0 AT nifty DOT ne DOT jp> | |
| <20240120141349 DOT cde31e62177a0405b0ee9934 AT nifty DOT ne DOT jp> | |
| <87v87ov03x DOT fsf AT Gerda DOT invalid> | |
| <20240120212427 DOT 1e69fd3655ece73ecd508def AT nifty DOT ne DOT jp> | |
| <20240121201051 DOT 795a4405576a97ab8729e273 AT nifty DOT ne DOT jp> | |
| <87fryqizl3.fsf@> | |
| <20240122123023 DOT b8eaac0e50d1e8856f44a115 AT nifty DOT ne DOT jp> | |
| MIME-Version: | 1.0 |
| In-Reply-To: | <20240122123023.b8eaac0e50d1e8856f44a115@nifty.ne.jp> |
| X-BeenThere: | cygwin AT cygwin DOT com |
| X-Mailman-Version: | 2.1.30 |
| List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
| List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
| List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
| List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
| From: | Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com> |
| Reply-To: | cygwin AT cygwin DOT com |
| Cc: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| Errors-To: | cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com |
| Sender: | "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com> |
On Jan 22 12:30, Takashi Yano via Cygwin wrote:
> PATCH2: (for cygwin)
> Avoid handle leak caused when non-static pthread_once_t is initialized
> with PTHREAD_ONCE_INIT
> diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
> index 7bb4f9fc8..127569160 100644
> --- a/winsup/cygwin/thread.cc
> +++ b/winsup/cygwin/thread.cc
> @@ -2060,6 +2060,9 @@ pthread::once (pthread_once_t *once_control, void (*init_routine) (void))
> {
> init_routine ();
> once_control->state = 1;
> + pthread_mutex_unlock (&once_control->mutex);
> + while (pthread_mutex_destroy (&once_control->mutex) == EBUSY);
> + return 0;
> }
> /* Here we must remove our cancellation handler */
> pthread_mutex_unlock (&once_control->mutex);
I see what you're doing here. Wouldn't it be simpler, though, to do this?
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 7bb4f9fc8341..7ec3aace395d 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -2063,6 +2063,7 @@ pthread::once (pthread_once_t *once_control, void (*init_routine) (void))
}
/* Here we must remove our cancellation handler */
pthread_mutex_unlock (&once_control->mutex);
+ while (pthread_mutex_destroy (&once_control->mutex) == EBUSY);
return 0;
}
Corinna
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |