This is the mail archive of the
mailing list for the libstdc++ project.
PATCH: Enhance GTHREAD interface defined in gthr.h
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Subject: PATCH: Enhance GTHREAD interface defined in gthr.h
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Date: Wed, 13 Jun 2001 00:31:43 -0400 (EDT)
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
The gthr-dce.h patch is here:
I am being overly strong when I say that systems "must" define
__GTHREAD_MUTEX_INIT_DEFAULT if they define __GTHREAD_MUTEX_INIT_FUNCTION.
At the moment, lack of a definition will just cause a warning in the
compilation of stl-inst.cc. 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 email@example.com
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2001-06-12 John David Anglin <firstname.lastname@example.org>
* 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
- 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
+ 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: