aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/ext/mt_allocator.h
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2006-09-02 08:31:45 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2006-09-02 08:31:45 +0000
commit1d3e6248e59e6f7bca2c49ba367de9cc296837de (patch)
treefccd6471b2b07451f58ce618be89804c2617a96b /libstdc++-v3/include/ext/mt_allocator.h
parentb73aec4fa5506d3f657aede2e44f989a894cf7aa (diff)
downloadgcc-1d3e6248e59e6f7bca2c49ba367de9cc296837de.zip
gcc-1d3e6248e59e6f7bca2c49ba367de9cc296837de.tar.gz
gcc-1d3e6248e59e6f7bca2c49ba367de9cc296837de.tar.bz2
re PR libstdc++/24469 (Possible race condition in mt_allocator causing SIGSEGV)
2006-09-02 Paolo Carlini <pcarlini@suse.de> Richard Guenther <rguenther@suse.de> PR libstdc++/24469 * src/mt_allocator.cc (__pool<true>::_M_reserve_block, __pool<true>::_M_reclaim_block): Fix the logic to avoid races, exploit atomic counters stored in second part of the memory pointed by _M_used. (__pool<true>::_M_initialize): Adjust _M_used allocation. * include/ext/mt_allocator.h (__pool<true>::_Bin_record): Update comment. Co-Authored-By: Richard Guenther <rguenther@suse.de> From-SVN: r116660
Diffstat (limited to 'libstdc++-v3/include/ext/mt_allocator.h')
-rw-r--r--libstdc++-v3/include/ext/mt_allocator.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h
index ae20d16..2379d82 100644
--- a/libstdc++-v3/include/ext/mt_allocator.h
+++ b/libstdc++-v3/include/ext/mt_allocator.h
@@ -298,8 +298,13 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// An "array" of counters used to keep track of the amount of
// blocks that are on the freelist/used for each thread id.
- // Memory to these "arrays" is allocated in _S_initialize() for
- // _S_max_threads + global pool 0.
+ // - Note that the second part of the allocated _M_used "array"
+ // actually hosts (atomic) counters of reclaimed blocks: in
+ // _M_reserve_block and in _M_reclaim_block those numbers are
+ // subtracted from the first ones to obtain the actual size
+ // of the "working set" of the given thread.
+ // - Memory to these "arrays" is allocated in _S_initialize()
+ // for _S_max_threads + global pool 0.
size_t* _M_free;
size_t* _M_used;