Re: std::mutex bug: Windows handle growth

Corinna Vinschen via Cygwin <[email protected]> Mon, 23 Mar 2026 11:24:37 +0100
Newsgroups gmane.os.cygwin
Message-ID <[email protected]>
Hi Achim,

On Mar 21 21:06, ASSI via Cygwin wrote:
> Frank Eskesen via Cygwin writes:
> > I've run into a problem that occurs on Cygwin that doesn't occur on
> > Linux systems: When a std::mutex is used, it doesn't clean up a
> > Windows handle that it uses.
> 
> I've applied the fix provided by Corinna and built a test version on top
> of the current gcc-13.4 snapshot.  Please test.
> 
> https://repo.or.cz/gcc/cygwin-gcc.git/commitdiff/f3429b7ec960fea9df62bc3c14e257d60fe436f0
> 
> The bug was already reported upstream a long time ago as FreeBSD also
> has an implementation where the mutex can not be destroyed trivially:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71684

Reading this bug report, wouldn't just defining
_GTHREAD_USE_MUTEX_INIT_FUNC for Cygwin have the same effect?


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