From: Jason Merrill <jason@cygnus.com>
To: hjl@lucon.org (H.J. Lu)
Cc: egcs@cygnus.com, drepper@cygnus.com
Subject: Re: A STL patch for egcs 1.0.2
Date: Thu, 19 Feb 1998 12:42:00 -0000 [thread overview]
Message-ID: <u9sopfjt3n.fsf@yorick.cygnus.com> (raw)
In-Reply-To: <m0y5azh-00058fC@ocean.lucon.org>
>>>>> H J Lu <hjl@lucon.org> writes:
>> I still think not enough people are writing threaded code to make this
> It is kind of saying noone uses namespace with g++. Yes, they are
> people using thread with glibc 2. Yes, some of them use C++. I don't
> think making libstdc++ thread-unsafe is acceptable for glibc 2. BTW,
> my change only affects glibc 2. The rest remains the same.
Oh, all right.
>> necessary for 1.0.2. Also, your patch changes more than necessary; there's
>> no need to add #includes of stl_config.h.
> STL needs a way to find the system is based on glibc 2 so that
> thread is enabled for glibc 2 automatically. Do you have any
> suggestions?
I meant that stl_config.h will have been included already at the points
where you added the #includes, so they are no-ops. Here's a simplified
patch, with a couple other changes that I suggested in our conversation
with Matt:
Wed Jan 14 16:15:05 1998 H.J. Lu (hjl@gnu.org)
* ropeimpl.h: Check __STL_PTHREADS instead of _PTHREADS.
* stl_alloc.h: Ditto.
* stl_config.h: Ditto.
* stl_rope.h: Ditto.
* stl_config.h: include <_G_config.h> if __GNUC__ is defined.
(__STL_PTHREADS): Defined if _PTHREADS is defined or
__GLIBC__ >= 2 and _NOTHREADS is not defined.
Index: ropeimpl.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/stl/ropeimpl.h,v
retrieving revision 1.2.2.1
diff -c -p -r1.2.2.1 ropeimpl.h
*** ropeimpl.h 1997/11/04 20:13:53 1.2.2.1
--- ropeimpl.h 1998/02/18 18:29:00
*************** rope<charT, Alloc>::rope(size_t n, charT
*** 1429,1435 ****
template<class charT, class Alloc> charT rope<charT,Alloc>::empty_c_str[1];
! # ifdef _PTHREADS
template<class charT, class Alloc>
pthread_mutex_t rope<charT,Alloc>::swap_lock = PTHREAD_MUTEX_INITIALIZER;
# endif
--- 1429,1435 ----
template<class charT, class Alloc> charT rope<charT,Alloc>::empty_c_str[1];
! # ifdef __STL_PTHREADS
template<class charT, class Alloc>
pthread_mutex_t rope<charT,Alloc>::swap_lock = PTHREAD_MUTEX_INITIALIZER;
# endif
Index: stl_alloc.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/stl/stl_alloc.h,v
retrieving revision 1.1.2.1
diff -c -p -r1.1.2.1 stl_alloc.h
*** stl_alloc.h 1997/11/04 20:14:06 1.1.2.1
--- stl_alloc.h 1998/02/18 18:29:01
***************
*** 61,72 ****
# define __RESTRICT
#endif
! #if !defined(_PTHREADS) && !defined(_NOTHREADS) \
&& !defined(__STL_SGI_THREADS) && !defined(__STL_WIN32THREADS)
# define _NOTHREADS
#endif
! # ifdef _PTHREADS
// POSIX Threads
// This is dubious, since this is likely to be a high contention
// lock. Performance may not be adequate.
--- 61,72 ----
# define __RESTRICT
#endif
! #if !defined(__STL_PTHREADS) && !defined(_NOTHREADS) \
&& !defined(__STL_SGI_THREADS) && !defined(__STL_WIN32THREADS)
# define _NOTHREADS
#endif
! # ifdef __STL_PTHREADS
// POSIX Threads
// This is dubious, since this is likely to be a high contention
// lock. Performance may not be adequate.
*************** private:
*** 357,363 ****
static inline void __unlock(volatile unsigned long *);
# endif
! # ifdef _PTHREADS
static pthread_mutex_t __node_allocator_lock;
# endif
--- 357,363 ----
static inline void __unlock(volatile unsigned long *);
# endif
! # ifdef __STL_PTHREADS
static pthread_mutex_t __node_allocator_lock;
# endif
*************** __default_alloc_template<threads, inst>:
*** 558,564 ****
return(result);
}
! #ifdef _PTHREADS
template <bool threads, int inst>
pthread_mutex_t
__default_alloc_template<threads, inst>::__node_allocator_lock
--- 558,564 ----
return(result);
}
! #ifdef __STL_PTHREADS
template <bool threads, int inst>
pthread_mutex_t
__default_alloc_template<threads, inst>::__node_allocator_lock
Index: stl_config.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/stl/stl_config.h,v
retrieving revision 1.3.2.1
diff -c -p -r1.3.2.1 stl_config.h
*** stl_config.h 1997/11/04 20:14:09 1.3.2.1
--- stl_config.h 1998/02/18 18:29:01
***************
*** 71,76 ****
--- 71,80 ----
// (19) Defines __stl_assert either as a test or as a null macro,
// depending on whether or not __STL_ASSERTIONS is defined.
+ #if defined(_PTHREADS)
+ # define __STL_PTHREADS
+ #endif
+
# if defined(__sgi) && !defined(__GNUC__)
# if !defined(_BOOL)
# define __STL_NEED_BOOL
***************
*** 93,105 ****
# if (_COMPILER_VERSION >= 721) && defined(_NAMESPACES)
# define __STL_USE_NAMESPACES
# endif
! # if !defined(_NOTHREADS) && !defined(_PTHREADS)
# define __STL_SGI_THREADS
# endif
# endif
# ifdef __GNUC__
! # if 0 && (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8))
# define __STL_STATIC_TEMPLATE_MEMBER_BUG
# define __STL_NEED_TYPENAME
# define __STL_NEED_EXPLICIT
--- 97,110 ----
# if (_COMPILER_VERSION >= 721) && defined(_NAMESPACES)
# define __STL_USE_NAMESPACES
# endif
! # if !defined(_NOTHREADS) && !defined(__STL_PTHREADS)
# define __STL_SGI_THREADS
# endif
# endif
# ifdef __GNUC__
! # include <_G_config.h>
! # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
# define __STL_STATIC_TEMPLATE_MEMBER_BUG
# define __STL_NEED_TYPENAME
# define __STL_NEED_EXPLICIT
***************
*** 108,113 ****
--- 113,121 ----
# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
# define __STL_MEMBER_TEMPLATES
+ # endif
+ # if !defined(_NOTHREADS) && __GLIBC__ >= 2
+ # define __STL_PTHREADS
# endif
# ifdef __EXCEPTIONS
# define __STL_USE_EXCEPTIONS
Index: stl_rope.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/stl/stl_rope.h,v
retrieving revision 1.1.2.1
diff -c -p -r1.1.2.1 stl_rope.h
*** stl_rope.h 1997/11/04 20:14:35 1.1.2.1
--- stl_rope.h 1998/02/18 18:29:01
*************** struct __rope_RopeBase {
*** 306,312 ****
{
return InterlockedDecrement(&refcount);
}
! # elif defined(_PTHREADS)
// This should be portable, but performance is expected
// to be quite awful. This really needs platform specific
// code.
--- 306,312 ----
{
return InterlockedDecrement(&refcount);
}
! # elif defined(__STL_PTHREADS)
// This should be portable, but performance is expected
// to be quite awful. This really needs platform specific
// code.
*************** class rope {
*** 939,945 ****
static cstrptr atomic_swap(cstrptr *p, cstrptr q) {
return (cstrptr) InterlockedExchange((LPLONG)p, (LONG)q);
}
! # elif defined(_PTHREADS)
// This should be portable, but performance is expected
// to be quite awful. This really needs platform specific
// code.
--- 939,945 ----
static cstrptr atomic_swap(cstrptr *p, cstrptr q) {
return (cstrptr) InterlockedExchange((LPLONG)p, (LONG)q);
}
! # elif defined(__STL_PTHREADS)
// This should be portable, but performance is expected
// to be quite awful. This really needs platform specific
// code.
next prev parent reply other threads:[~1998-02-19 12:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-02-17 9:51 (1.0.2) std/bastring.h change -- Why add std/bastring.cc? Mumit Khan
1998-02-17 10:40 ` Joe Buck
[not found] ` <199802171840.KAA06006.cygnus.egcs@atrus.synopsys.com>
1998-02-17 13:54 ` Jason Merrill
1998-02-17 15:16 ` H.J. Lu
1998-02-17 23:59 ` Mumit Khan
1998-02-18 14:54 ` H.J. Lu
1998-02-18 14:54 ` A STL patch for egcs 1.0.2 H.J. Lu
[not found] ` <m0y5H2p-00058KC.cygnus.egcs@ocean.lucon.org>
1998-02-19 10:45 ` (1.0.2) std/bastring.h change -- Why add std/bastring.cc? Jason Merrill
[not found] ` <m0y5H5T-00058KC.cygnus.egcs@ocean.lucon.org>
1998-02-19 10:47 ` A STL patch for egcs 1.0.2 Jason Merrill
1998-02-19 10:47 ` H.J. Lu
1998-02-19 12:42 ` Jason Merrill [this message]
1998-02-20 12:26 ` H.J. Lu
1998-02-20 12:26 ` Jason Merrill
1998-02-20 12:26 ` H.J. Lu
1998-02-20 11:09 ` Jason Merrill
1998-02-19 14:09 ` Ulrich Drepper
1998-02-22 16:39 ` Jeffrey A Law
1998-02-23 11:00 ` H.J. Lu
1998-02-23 9:19 ` Jeffrey A Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=u9sopfjt3n.fsf@yorick.cygnus.com \
--to=jason@cygnus.com \
--cc=drepper@cygnus.com \
--cc=egcs@cygnus.com \
--cc=hjl@lucon.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).