aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2004-03-26 16:56:09 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2004-03-26 16:56:09 +0000
commitdd95381f8a60deb34874609b78ecaf3fb3b11ad0 (patch)
tree92dcf3c09f4557a80f25d236f45f0d777efa9ea5
parenteabe2b296920893b0940839e12f880e4f0d38684 (diff)
downloadgcc-dd95381f8a60deb34874609b78ecaf3fb3b11ad0.zip
gcc-dd95381f8a60deb34874609b78ecaf3fb3b11ad0.tar.gz
gcc-dd95381f8a60deb34874609b78ecaf3fb3b11ad0.tar.bz2
mt_allocator.h (__mt_alloc<>::allocate, [...]): Protect two instances of block->thread_id with __GTHREADS.
2004-03-26 Paolo Carlini <pcarlini@suse.de> * include/ext/mt_allocator.h (__mt_alloc<>::allocate, __mt_alloc<>::deallocate): Protect two instances of block->thread_id with __GTHREADS. From-SVN: r79986
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/ext/mt_allocator.h4
2 files changed, 8 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 2ca2d2a..8c6e3f9 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2004-03-26 Paolo Carlini <pcarlini@suse.de>
+
+ * include/ext/mt_allocator.h (__mt_alloc<>::allocate,
+ __mt_alloc<>::deallocate): Protect two instances of
+ block->thread_id with __GTHREADS.
+
2004-03-25 Gawain Bolton <gp.bolton@computer.org>
* include/bits/stl_tree.h (_Rb_tree_impl): Add _Node_allocator
diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h
index 943cff7..d19849d 100644
--- a/libstdc++-v3/include/ext/mt_allocator.h
+++ b/libstdc++-v3/include/ext/mt_allocator.h
@@ -405,9 +405,9 @@ namespace __gnu_cxx
// grab the first record and update the counters.
block = __bin.first[__thread_id];
__bin.first[__thread_id] = __bin.first[__thread_id]->next;
- block->thread_id = __thread_id;
#ifdef __GTHREADS
+ block->thread_id = __thread_id;
if (__gthread_active_p())
{
__bin.free[__thread_id]--;
@@ -436,13 +436,13 @@ namespace __gnu_cxx
// Round up to power of 2 and figure out which bin to use.
const size_t __which = _S_binmap[__bytes];
- const size_t thread_id = _S_get_thread_id();
const bin_record& __bin = _S_bin[__which];
char* __c = reinterpret_cast<char*>(__p) - sizeof(block_record);
block_record* block = reinterpret_cast<block_record*>(__c);
#ifdef __GTHREADS
+ const size_t thread_id = _S_get_thread_id();
if (__gthread_active_p())
{
// Calculate the number of records to remove from our freelist.