OSDN Git Service

2005-03-23 Benjamin Kosnik <bkoz@redhat.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / src / debug.cc
index 0ca9238..3375adf 100644 (file)
@@ -1,6 +1,6 @@
 // Debugging mode support code -*- C++ -*-
 
-// Copyright (C) 2003, 2004
+// Copyright (C) 2003, 2004, 2005
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 #include <cstring>
 #include <cstdio>
 #include <cctype>
+#include <bits/concurrence.h>
 
 using namespace std;
 
+namespace __gnu_internal
+{
+  __glibcxx_mutex_define_initialized(iterator_base_mutex);
+} // namespace __gnu_internal
+
 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)
       {
+       __gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex);
        _M_sequence = __seq;
        _M_version = _M_sequence->_M_version;
        _M_prior = 0;
@@ -212,6 +219,7 @@ namespace __gnu_debug
   _Safe_iterator_base::
   _M_detach()
   {
+    __gnu_cxx::lock sentry(__gnu_internal::iterator_base_mutex);
     if (_M_sequence)
       {
        // Remove us from this sequence's list
@@ -499,7 +507,7 @@ namespace __gnu_debug
   template<typename _Tp>
     void
     _Error_formatter::_M_format_word(char* __buf, 
-                                    int __n __attribute__((__unused__)), 
+                                    int __n __attribute__ ((__unused__)), 
                                     const char* __fmt, _Tp __s) const
     {
 #ifdef _GLIBCXX_USE_C99
@@ -645,21 +653,20 @@ namespace __gnu_debug
   // Instantiations.
   template
     void
-    _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt
-                                    const void* __s) const;
+    _Error_formatter::_M_format_word(char*, int, const char*
+                                    const void*) const;
 
   template
     void
-    _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt, 
-                                    long __s) const;
+    _Error_formatter::_M_format_word(char*, int, const char*, long) const;
 
   template
     void
-    _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt
-                                    std::size_t __s) const;
+    _Error_formatter::_M_format_word(char*, int, const char*
+                                    std::size_t) const;
 
   template
     void
-    _Error_formatter::_M_format_word(char* __buf, int __n, const char* __fmt
-                                    const char* __s) const;
+    _Error_formatter::_M_format_word(char*, int, const char*
+                                    const char*) const;
 } // namespace __gnu_debug