re PR libstdc++/17664 ([3.4 only] Crash in std::map when using _GLIBCXX_DEBUG with multithreading)

2004-11-08  Benjamin Kosnik  <bkoz@redhat.com>
	    Doug Gregor  <dgregor@cs.indiana.edu>

	PR libstdc++/17664
	* src/debug.cc: Just use one mutex.

Co-Authored-By: Doug Gregor <dgregor@cs.indiana.edu>
Co-Authored-By: Lothar Werzinger <lothar@xcerla.com>

From-SVN: r90296
This commit is contained in:
Benjamin Kosnik 2004-11-08 20:47:25 +00:00 committed by Benjamin Kosnik
parent b03c0b9324
commit 948af8ae9c
2 changed files with 10 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2004-11-08 Benjamin Kosnik <bkoz@redhat.com>
Doug Gregor <dgregor@cs.indiana.edu>
PR libstdc++/17664
* src/debug.cc : Just use one mutex.
2004-11-08 Benjamin Kosnik <bkoz@redhat.com> 2004-11-08 Benjamin Kosnik <bkoz@redhat.com>
* configure.ac (libtool_VERSION): To 6:4:0. * configure.ac (libtool_VERSION): To 6:4:0.
@ -118,7 +124,7 @@
2004-11-02 Benjamin Kosnik <bkoz@redhat.com> 2004-11-02 Benjamin Kosnik <bkoz@redhat.com>
Lothar Werzinger <lothar@xcerla.com> Lothar Werzinger <lothar@xcerla.com>
PR libstdc++/17627 PR libstdc++/17664
* src/debug.cc: Include concurrence, use mutexes. * src/debug.cc: Include concurrence, use mutexes.
(_Safe_iterator_base::_M_attach): Here. (_Safe_iterator_base::_M_attach): Here.
(_Safe_iterator_base::_M_detach): Here. (_Safe_iterator_base::_M_detach): Here.

View File

@ -43,9 +43,7 @@ using namespace std;
namespace __gnu_internal namespace __gnu_internal
{ {
__glibcxx_mutex_define_initialized(iterator_base_attach_mutex); __glibcxx_mutex_define_initialized(iterator_base_mutex);
__glibcxx_mutex_define_initialized(iterator_base_detach_mutex);
} // namespace __gnu_internal } // namespace __gnu_internal
namespace __gnu_debug namespace __gnu_debug
@ -196,7 +194,7 @@ namespace __gnu_debug
// Attach to the new sequence (if there is one) // Attach to the new sequence (if there is one)
if (__seq) if (__seq)
{ {
__gnu_cxx::lock sentry(__gnu_internal::iterator_base_attach_mutex); __gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex);
_M_sequence = __seq; _M_sequence = __seq;
_M_version = _M_sequence->_M_version; _M_version = _M_sequence->_M_version;
_M_prior = 0; _M_prior = 0;
@ -221,7 +219,7 @@ namespace __gnu_debug
_Safe_iterator_base:: _Safe_iterator_base::
_M_detach() _M_detach()
{ {
__gnu_cxx::lock sentry(__gnu_internal::iterator_base_detach_mutex); __gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex);
if (_M_sequence) if (_M_sequence)
{ {
// Remove us from this sequence's list // Remove us from this sequence's list