This is the mail archive of the 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]

PATCH: Enhance GTHREAD interface defined in gthr.h

This patch describes an enhancement to the GTHREAD interface for systems
that define __GTHREAD_MUTEX_INIT_FUNCTION.  A new initializer macro
__GTHREAD_MUTEX_INIT_DEFAULT is introduced to provide a mechanism to
initialize structs and classes with __gthread_mutex_t members.  This
patch and the one to gthr-dce.h are needed to support the runtime
initialization of the _STL_mutex_lock struct used in libstdc++ for
STL threads under hpux 10.X.  Details on why aggregate initialization
is the preferred method of initializing this structure are discussed
int stl_threads.h.

The gthr-dce.h patch is here:

I am being overly strong when I say that systems "must" define
At the moment, lack of a definition will just cause a warning in the
compilation of  However, it would be good to have a
consistent interface now that gthr.h is installed.

The files which lack defines are gthr-rtems.h and gthr-win32.h.  Hopefully,
their maintainers can determine what is needed for these systems.


J. David Anglin                        
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-06-12  John David Anglin  <>

	* gthr.h (__GTHREAD_MUTEX_INIT_DEFAULT): New interface macro.

--- gthr.h.orig	Sat Jun  9 16:07:22 2001
+++ gthr.h	Tue Jun 12 17:07:24 2001
@@ -49,11 +49,19 @@
      		to initialize __gthread_mutex_t to get a fast
 		non-recursive mutex.
-     		some systems can't initalize a mutex without a
+     		some systems can't initialize a mutex without a
 		function call.  On such systems, define this to a
 		function which looks like this:
 		  void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
 		Don't define __GTHREAD_MUTEX_INIT in this case
+   Systems that define __GTHREAD_MUTEX_INIT_FUNCTION must also
+   define:
+		to initialize __gthread_mutex_t to an arbitrary
+		default.  This allows __gthread_mutex_t types to
+		be members of initialized structures and classes.
    The threads interface must define the following static functions:

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