This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/55471] c++ mutex does not work as expected
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 26 Nov 2012 19:24:38 +0000
- Subject: [Bug libstdc++/55471] c++ mutex does not work as expected
- Auto-submitted: auto-generated
- References: <bug-55471-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55471
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-11-26 19:24:38 UTC ---
Almost certainly what happens is that the mutex m gets destroyed when returning
from main, but there are threads still using it and so they can no longer lock
it.
It's undefined behaviour to lock a mutex after its destructor starts, so this
is a bug in your program, not GCC.