delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2026/09/19/23:37:04

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 68K3b4tE729651
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 68K3b4tE729651
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=bZ3new49
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C55FD4B9DB68
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1789875407;
bh=RU3XuYv0vq50o07666D54c2FpXSmSI7yxdfdtUrfLK0=;
h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=bZ3new49TsvhID558PW1wftcumFvdRyfCqXgvh16juDifRSvf2K4cc+kv7UG3kS15
i8pRceFh+a90ms0sz5B6eUPiLvpPhne4qQNejU9N/F5Sz9/VzKXB0eyr5APxHCR+V/
RkRTMEeUOpDhAytbfiIRFU+RLCpK51UBlbEgr6HQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D480C4B9DB48
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D480C4B9DB48
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789875363; cv=none;
b=IVCiqP8z0nMhCfv58J01wCo6B7bzJUlQ1rTT2YWsPs1o9XgMlCCNdGqq0UZKt+qgeV5BmOyIJdgePgHm8ejjGUPoeo6H2qDY6QBsAxTFo8iO1kKPMtU2q1+rlq3nOgfe6piwsuqLid5LIfLJZVvla8U4PNxwoOCtPF9/21OpkzY=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1789875363; c=relaxed/simple;
bh=dVOrIkqav54HsZPgQCUDbyWh/OS5jd6aBxL2LUgeK4k=;
h=DKIM-Signature:Message-Id:From:To:Subject:Date:MIME-Version;
b=LaswGsw7InzXaUh54yMnY3B8zt/fqmFHEQ+TjR0sDDHefdubzYw9p9WUcUWEp8bHkZB9quO+cw9lbOuYqFbMBgKFoJscjWK53w8KrOlQMlmnr8/MDpJilJUBHcxIYEmkI7xF+KPCLr2RtDWDBw98MIB7Flq0+01A/6ywjcrCIl4=
ARC-Authentication-Results: i=1; sourceware.org;
dkim=pass (2048-bit key, unprotected)
header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104
header.b=Ad11RW42
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D480C4B9DB48
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1789875362; x=1790480162;
h=mime-version:content-transfer-encoding:user-agent:references
:in-reply-to:date:subject:to:from:message-id:content-type:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=PJoB7hNOSjxS2TRHe6dgbnJonaauQ1cO6Nl+OLN1ZwM=;
b=rDD7wQRKH41T//C3EIMZIlCRdxpSR92BGq9oNYTrldPkjs39VdpEJ535TfOeTAdFVa
AkulfAhqj5BSrNZ810WfkCDIMkhFDFL76xOUknEy7kTKU/7yiCCovVpoER/j9z5R1WX/
Pg3srWAdxSJTwYxqMiDg9xt8XGfBsltmltGPt+8C4MPHenkf7+u7g/Zj6K8pM0mf9S/F
L9G9sbYcYkFNmoXB4VEYsZICcRrBETPFNiSNuPJB0hqk5FPlie/LleKjaGyGUinwnluH
p5mZ7fUiL9whaJwzIW/xtRiPciX9FbhUJsSm/9N4wdGCysqLf7RQoi+mzKMUjBakw3rz
X5jA==
X-Gm-Message-State: AFuF++lt9RrmJ4dhEcMMnCgcIslDwNwNhQSjLq7cdkTIGc2w8N6PYovB
N46dAxO7XWgCcOP+7+qeFcqm5Svotxq28smA0yZbmpNG1i+zfd6Tr6briD8MMw==
X-Gm-Gg: AYBFou0NsXTKKeN+jX4cjTLfKCmpH/MJpUgeZ7690y2IkunOfOde/PqO4efPFwh3FTR
FUPHvjppW9V2q4jDUPytlC3aWS8Nl+ee3EfzPR06vXV/uFloUmVeK6bIdG7CNIfaUv7Xc+JCUGF
cjtEXrFBBHu5G2iqgFakTKY3s8tTnt+IZJLJQ6x5xm9dXRNg1ZW+L9eQjoM5r6x23FB7bUyd6Ku
5r2YDnRbBZoKumGG8zFu4ZjeK0AmfwSzIGXXACGiFiE1yS9c3L4EN8SbyS03E3ZJJC6YGMPjhTJ
O5c3kEcNCf4S5MDOrL5rC75+pZY82OvBbc39E/jdQN/mARQtiQNRHK/Wg/+ZyTB/yFciS8g6Ffk
dGO1Yoxk25EH0SYLOmoMV6bKBL/y2h7cppYMsuznCFc0NZcwcCLnk0dk/hEewhN8UrLOmLQ+ihY
E2zZpU3Gx1ETnaWwoxbkJ8NmHYReviVo4u7P8jMmK9Q7HL65A0zuy5c1CSqEf8XN2Pmm9JjA1ps
I9sFkITXi5BQm7K4ObM+7w=
X-Received: by 2002:a05:6a00:94ed:b0:871:eea6:95f4 with SMTP id
d2e1a72fcca58-874dd9f1531mr11635197b3a.19.1789875361572;
Sat, 19 Sep 2026 20:36:01 -0700 (PDT)
Message-Id: <1789874331491.1956582693.4000809197@gmail.com>
To: cygwin AT cygwin DOT com
Subject: Re: std::mutex bug: Windows handle growth
Date: Sun, 20 Sep 2026 03:35:58 +0000
In-Reply-To: <abmnASrGinx_OnuY@calimero.vinschen.de>
References: <abmnASrGinx_OnuY AT calimero DOT vinschen DOT de>
X-Mailer: Vivaldi Mail
User-Agent: Vivaldi Mail/8.2.4133.52
MIME-Version: 1.0
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: kikairoya via Cygwin <cygwin AT cygwin DOT com>
Reply-To: kikairoya <kikairoya AT gmail 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>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 68K3b4tE729651

Hi,

std::shared_mutex (actually, __shared_mutex_pthread) appears to need a similar fix.
Could you take a look?


2026年3月18日 4:09:53 (+09:00) で、Corinna Vinschen via Cygwin さんが書きました:
> 
> The actual problem here is the `#ifdef __GTHREAD_MUTEX_INIT'.
> 
> __GTHREAD_MUTEX_INIT translates into PTHREAD_MUTEX_INIT.  If this is
> defined, you will notice the there's *no* destructor defined for class
> __mutex_base.  Apparently the assumption is made that the underlying
> pthread_mutex_t type is a trivial type which doesn't need a destroy(),
> if PTHREAD_MUTEX_INIT exists.
> 
> However, this is wrong for Cygwin.  It defines PTHREAD_MUTEX_INIT, but
> it still needs a pthread_mutex_destroy() call, because the pthread_mutex_t
> type is not a trivial one.
> 
> Thus, we need a destructor even if __GTHREAD_MUTEX_INIT is defined.
> 
> A potential fix would be 
> 
> diff --git a/libstdc++-v3/include/bits/std_mutex.h b/libstdc++-v3/include/bits/std_mutex.h
> index 7ef33fe5d0d7..f060c75abf21 100644
> --- a/libstdc++-v3/include/bits/std_mutex.h
> +++ b/libstdc++-v3/include/bits/std_mutex.h
> @@ -68,6 +68,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      __native_type  _M_mutex = __GTHREAD_MUTEX_INIT;
>  
>      constexpr __mutex_base() noexcept = default;
> +#ifdef __CYGWIN__
> +    ~__mutex_base() noexcept { __gthread_mutex_destroy(&_M_mutex); }
> +#endif
>  #else
>      __native_type  _M_mutex;
> 

-- 
Tomohiro Kashiwada (@kikairoya)

-- 
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2026   by DJ Delorie     Updated Sep 20 2026