std::mutex bug: Windows handle growth
Noel Grandin
noelgrandin@gmail.com
Tue Mar 17 07:06:39 GMT 2026
Hi
Hazarding a guess here:
On 3/16/2026 11:39 PM, Frank Eskesen via Cygwin wrote:
> 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. This sample program demonstrates the problem, failing in under 60
This code looks suspicious:
pthread_mutex::destroy ()
{
if (condwaits || trylock ())
// Do not destroy a condwaited or locked mutex
return EBUSY;
I think it should be
if (condwaits || !trylock ())
Regards, Noel Grandin
More information about the Cygwin
mailing list