[Bug libstdc++/46455] resource leaks due to missing destructors for mutexes and condvars

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 16 21:46:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46455

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #22413|0                           |1
        is obsolete|                            |

--- Comment #23 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-11-16 21:38:01 UTC ---
Created attachment 22424
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22424
add destructors in <ext/concurrence.h>

here's another patch, this one uses SFINAE to select an appropriate overload
based on the type of __gthread_recursive_mutex_t and if necessary extracts a
__gthread_mutex_t from it to pass to __gthread_mutex_destroy

this will be wrong if a recursive mutex type needs more cleanup than just
destroying its non-recursive mutex, though I don't think that's a problem for
any current systems supported by gthreads.

could be improved upon by disabling the third _S_destroy overload when
recursive_mutex_type is not the same as mutex_type, but it's ugly enough
already.

Zouzou, could you test this on mingw? thanks



More information about the Gcc-bugs mailing list