OSDN Git Service

2004-11-08 Benjamin Kosnik <bkoz@redhat.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / src / debug.cc
index 0ca9238..415fcbf 100644 (file)
 #include <cstring>
 #include <cstdio>
 #include <cctype>
 #include <cstring>
 #include <cstdio>
 #include <cctype>
+#include <bits/concurrence.h>
 
 using namespace std;
 
 
 using namespace std;
 
+namespace __gnu_internal
+{
+  __glibcxx_mutex_define_initialized(iterator_base_mutex);
+} // namespace __gnu_internal
+
 namespace __gnu_debug
 {
   const char* _S_debug_messages[] = 
 namespace __gnu_debug
 {
   const char* _S_debug_messages[] = 
@@ -188,6 +194,7 @@ namespace __gnu_debug
     // Attach to the new sequence (if there is one)
     if (__seq)
       {
     // Attach to the new sequence (if there is one)
     if (__seq)
       {
+       __gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex);
        _M_sequence = __seq;
        _M_version = _M_sequence->_M_version;
        _M_prior = 0;
        _M_sequence = __seq;
        _M_version = _M_sequence->_M_version;
        _M_prior = 0;
@@ -212,6 +219,7 @@ namespace __gnu_debug
   _Safe_iterator_base::
   _M_detach()
   {
   _Safe_iterator_base::
   _M_detach()
   {
+    __gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex);
     if (_M_sequence)
       {
        // Remove us from this sequence's list
     if (_M_sequence)
       {
        // Remove us from this sequence's list