PATCH: Enhance GTHREAD interface defined in gthr.h
John David Anglin
dave@hiauly1.hia.nrc.ca
Tue Jun 12 21:31:00 GMT 2001
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:
< http://gcc.gnu.org/ml/gcc-patches/2001-06/msg00879.html >.
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.
OK?
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2001-06-12 John David Anglin <dave@hiauly1.hia.nrc.ca>
* 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.
__GTHREAD_MUTEX_INIT_FUNCTION
- 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:
+
+ __GTHREAD_MUTEX_INIT_DEFAULT
+ 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:
More information about the Libstdc++
mailing list