Commit bd8fd826 by Loren J. Rittle Committed by Loren J. Rittle

howto.html: Update commentary.

	* docs/html/ext/howto.html: Update commentary.
	* include/bits/c++config: Update threading configuration comment.
	(__STL_GTHREADS): Remove macro definition.
	(__STL_THREADS): Likewise.
	* include/bits/stl_threads.h: Leave only the configuration
	path which had been guarded by __STL_GTHREADS.  Remove all
	guards related to __STL_GTHREADS, __STL_SGI_THREADS,
	__STL_PTHREADS, __STL_UITHREADS and __STL_WIN32THREADS.
	* include/bits/stl_alloc.h: Leave only the configuration path
	which had been guarded by __STL_THREADS.  Remove configuration
	path and guards for __STL_SGI_THREADS.
	(__NODE_ALLOCATOR_THREADS): Remove macro definition.  Unroll its use.
	(__NODE_ALLOCATOR_LOCK): Likewise.
	(__NODE_ALLOCATOR_UNLOCK): Likewise.
	(_NOTHREADS): Remove guards related to macro.
	* include/ext/stl_rope.h: Remove configuration path and guards
	for __STL_SGI_THREADS.
	* src/stl-inst.cc: Remove use of __NODE_ALLOCATOR_THREADS.

From-SVN: r47557
parent 13f08f03
2001-12-03 Loren J. Rittle <ljrittle@acm.org>
* docs/html/ext/howto.html: Update commentary.
* include/bits/c++config: Update threading configuration comment.
(__STL_GTHREADS): Remove macro definition.
(__STL_THREADS): Likewise.
* include/bits/stl_threads.h: Leave only the configuration
path which had been guarded by __STL_GTHREADS. Remove all
guards related to __STL_GTHREADS, __STL_SGI_THREADS,
__STL_PTHREADS, __STL_UITHREADS and __STL_WIN32THREADS.
* include/bits/stl_alloc.h: Leave only the configuration path
which had been guarded by __STL_THREADS. Remove configuration
path and guards for __STL_SGI_THREADS.
(__NODE_ALLOCATOR_THREADS): Remove macro definition. Unroll its use.
(__NODE_ALLOCATOR_LOCK): Likewise.
(__NODE_ALLOCATOR_UNLOCK): Likewise.
(_NOTHREADS): Remove guards related to macro.
* include/ext/stl_rope.h: Remove configuration path and guards
for __STL_SGI_THREADS.
* src/stl-inst.cc: Remove use of __NODE_ALLOCATOR_THREADS.
2001-12-02 Phil Edwards <pme@gcc.gnu.org>
* docs/html/ext/howto.html: Update list of implemented DRs.
......
......@@ -344,7 +344,8 @@
than you would depend on implementation-only names.
</p>
<p>Certain macros like <code>_NOTHREADS</code> and <code>__STL_THREADS</code>
can affect the 3.0.x allocators. Do not use them.
can affect the 3.0.x allocators. Do not use them. Those macros have
been completely removed for 3.1.
</p>
<p>More notes as we remember them...
</p>
......
......@@ -55,16 +55,12 @@
// Use corrected code from the committee library group's issues list.
#define _GLIBCPP_RESOLVE_LIB_DEFECTS 1
// Map gthr.h abstraction to that required for STL. Do not key off of
// __GTHREADS at this point since we haven't seen the correct symbol
// yet, instead setup so that include/bits/stl_threads.h will know to
// include gthr.h instead of any other type of thread support. Note:
// that gthr.h may well map to gthr-single.h which is a correct way to
// express no threads support in gcc. As a user, do not define
// _NOTHREADS without consideration of the consequences (e.g. it is an
// internal ABI change).
#define __STL_GTHREADS
#define __STL_THREADS
// In those parts of the standard C++ library that use a mutex instead
// of a spin-lock, we now unconditionally use GCC's gthr.h mutex
// abstraction layer. All support to directly map to various
// threading models has been removed. Note: gthr.h may well map to
// gthr-single.h which is a correct way to express no threads support
// in gcc. Support for the undocumented _NOTHREADS has been removed.
// Default to the typically high-speed, pool-based allocator (as
// libstdc++-v2) instead of the malloc-based allocator (libstdc++-v3
......
......@@ -73,39 +73,7 @@
#include <bits/std_cstdlib.h>
#include <bits/std_cstring.h>
#include <bits/std_cassert.h>
// To see the effects of this block of macro wrangling, jump to
// "Default node allocator" below.
#ifdef __STL_THREADS
# include <bits/stl_threads.h>
# define __NODE_ALLOCATOR_THREADS true
# ifdef __STL_SGI_THREADS
// We test whether threads are in use before locking.
// Perhaps this should be moved into stl_threads.h, but that
// probably makes it harder to avoid the procedure call when
// it isn't needed.
extern "C" {
extern int __us_rsthread_malloc;
}
// The above is copied from malloc.h. Including <malloc.h>
// would be cleaner but fails with certain levels of standard
// conformance.
# define __NODE_ALLOCATOR_LOCK if (__threads && __us_rsthread_malloc) \
{ _S_node_allocator_lock._M_acquire_lock(); }
# define __NODE_ALLOCATOR_UNLOCK if (__threads && __us_rsthread_malloc) \
{ _S_node_allocator_lock._M_release_lock(); }
# else /* !__STL_SGI_THREADS */
# define __NODE_ALLOCATOR_LOCK \
{ if (__threads) _S_node_allocator_lock._M_acquire_lock(); }
# define __NODE_ALLOCATOR_UNLOCK \
{ if (__threads) _S_node_allocator_lock._M_release_lock(); }
# endif
#else
// Thread-unsafe
# define __NODE_ALLOCATOR_LOCK
# define __NODE_ALLOCATOR_UNLOCK
# define __NODE_ALLOCATOR_THREADS false
#endif
#include <bits/stl_threads.h>
namespace std
{
......@@ -364,9 +332,7 @@ private:
static char* _S_end_free;
static size_t _S_heap_size;
#ifdef __STL_THREADS
static _STL_mutex_lock _S_node_allocator_lock;
#endif
static _STL_mutex_lock _S_node_allocator_lock;
// It would be nice to use _STL_auto_lock here. But we
// don't need the NULL check. And we do need a test whether
......@@ -375,8 +341,8 @@ private:
friend class _Lock;
class _Lock {
public:
_Lock() { __NODE_ALLOCATOR_LOCK; }
~_Lock() { __NODE_ALLOCATOR_UNLOCK; }
_Lock() { if (__threads) _S_node_allocator_lock._M_acquire_lock(); }
~_Lock() { if (__threads) _S_node_allocator_lock._M_release_lock(); }
};
public:
......@@ -394,10 +360,7 @@ public:
// Acquire the lock here with a constructor call.
// This ensures that it is released in exit or during stack
// unwinding.
# ifndef _NOTHREADS
/*REFERENCED*/
_Lock __lock_instance;
# endif
_Obj* __restrict__ __result = *__my_free_list;
if (__result == 0)
__ret = _S_refill(_S_round_up(__n));
......@@ -423,10 +386,7 @@ public:
_Obj* __q = (_Obj*)__p;
// acquire lock
# ifndef _NOTHREADS
/*REFERENCED*/
_Lock __lock_instance;
# endif /* _NOTHREADS */
__q -> _M_free_list_link = *__my_free_list;
*__my_free_list = __q;
// lock is released here
......@@ -582,13 +542,10 @@ __default_alloc_template<threads, inst>::reallocate(void* __p,
return(__result);
}
#ifdef __STL_THREADS
template <bool __threads, int __inst>
_STL_mutex_lock
__default_alloc_template<__threads, __inst>::_S_node_allocator_lock
__STL_MUTEX_INITIALIZER;
#endif
template <bool __threads, int __inst>
_STL_mutex_lock
__default_alloc_template<__threads, __inst>::_S_node_allocator_lock
__STL_MUTEX_INITIALIZER;
template <bool __threads, int __inst>
char* __default_alloc_template<__threads, __inst>::_S_start_free = 0;
......@@ -606,8 +563,7 @@ __default_alloc_template<__threads, __inst> ::_S_free_list[
] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
// __NODE_ALLOCATOR_THREADS is predicated on __STL_THREADS being defined or not
typedef __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0> alloc;
typedef __default_alloc_template<true, 0> alloc;
typedef __default_alloc_template<false, 0> single_client_alloc;
......
......@@ -60,9 +60,6 @@
# include <bits/stl_threads.h>
# define __GC_CONST // constant except for deallocation
# endif
# ifdef __STL_SGI_THREADS
# include <mutex.h>
# endif
namespace std
{
......
......@@ -42,7 +42,7 @@ namespace std
template class __malloc_alloc_template<0>;
#ifndef __USE_MALLOC
template class __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0>;
template class __default_alloc_template<true, 0>;
#endif
template
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment