This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

include/bits/concurrence.h breaks MinGW bootstrap


Hi People,

This is in reference to this post:

http://gcc.gnu.org/ml/libstdc++/2004-06/msg00351.html

I was able to unbreak the MinGW bootstrap with the
attached patch, but I haven't tested it at all. (Just
take it as a suggestion....) If someone wants me to follow
up on this, let me know.

If desired, please CC me directly as I am not subscribed
to the libstdc++ or gcc-patches mailing lists. Thanks.

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

2004-06-28  Mohan Embar  <gnustuff@thisiscool.com>

	* include/bits/concurrence.h (__glibcxx_mutex_lock_noinit):
	New macro.
	(__gnu_cxx::lock): Change device field from a pointer to a
	reference; use __glibcxx_mutex_lock_noinit in constructor
	instead of __glibcxx_mutex_lock.

Index: include/bits/concurrence.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/concurrence.h,v
retrieving revision 1.5
diff -u -2 -r1.5 concurrence.h
--- include/bits/concurrence.h	25 Jun 2004 16:36:13 -0000	1.5
+++ include/bits/concurrence.h	29 Jun 2004 04:16:13 -0000
@@ -51,4 +51,5 @@
 __gthread_once(&NAME ## _once, NAME ## _init); \
 __gthread_mutex_lock(&NAME)
+# define __glibcxx_mutex_lock_noinit(NAME) __gthread_mutex_lock(&NAME)
 # endif
 
@@ -63,4 +64,8 @@
 #endif
 
+#ifndef __glibcxx_mutex_lock_noinit
+# define __glibcxx_mutex_lock_noinit(NAME) __glibcxx_mutex_lock(NAME)
+#endif
+
 namespace __gnu_cxx
 {
@@ -68,14 +73,14 @@
   {
     // Externally defined and initialized.
-    __gthread_mutex_t* device;
+    __gthread_mutex_t& device;
 
   public:
     // Acquire the mutex here with a constructor call.  This ensures
     // that it is released in exit or during stack unwinding.
-    explicit lock(__gthread_mutex_t& name) : device(&name)
-    { __glibcxx_mutex_lock(*device); }
+    explicit lock(__gthread_mutex_t& name) : device(name)
+    { __glibcxx_mutex_lock_noinit(device); }
 
     ~lock() throw()
-    { __glibcxx_mutex_unlock(*device); }
+    { __glibcxx_mutex_unlock(device); }
 
   private:





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]