summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-05 22:46:04 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-05 22:46:04 +0000
commit9743a59d88c2b841ef2e20e38c8adea195a87f48 (patch)
tree52a5f77b5fe02d839c26bbfc413c21777be5a91b
parent78bc76346c0ad6b043e2c0d9eecb2933e00adc50 (diff)
downloadppe42-gcc-9743a59d88c2b841ef2e20e38c8adea195a87f48.tar.gz
ppe42-gcc-9743a59d88c2b841ef2e20e38c8adea195a87f48.zip
2004-04-05 Paolo Carlini <pcarlini@suse.de>
* include/ext/mt_allocator.h (__mt_alloc<>::deallocate): The critical section is actually very small, only two assignments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80439 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/include/ext/mt_allocator.h12
2 files changed, 10 insertions, 7 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 8ff1d837c58..5843ccfbf1f 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2004-04-05 Paolo Carlini <pcarlini@suse.de>
+
+ * include/ext/mt_allocator.h (__mt_alloc<>::deallocate):
+ The critical section is actually very small, only two assignments.
+
2004-04-04 Paolo Carlini <pcarlini@suse.de>
Petur Runolfsson <peturr02@ru.is>
diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h
index 401fc3f0d45..0b17aa2d209 100644
--- a/libstdc++-v3/include/ext/mt_allocator.h
+++ b/libstdc++-v3/include/ext/mt_allocator.h
@@ -430,20 +430,18 @@ namespace __gnu_cxx
* _S_options._M_freelist_headroom)
&& __remove > static_cast<long>(__bin._M_free[__thread_id]))
{
- __gthread_mutex_lock(__bin._M_mutex);
_Block_record* __tmp = __bin._M_first[__thread_id];
_Block_record* __first = __tmp;
__remove /= _S_options._M_freelist_headroom;
const long __removed = __remove;
- while (__remove > 1)
- {
- __tmp = __tmp->_M_next;
- --__remove;
- }
+ while (__remove-- > 1)
+ __tmp = __tmp->_M_next;
__bin._M_first[__thread_id] = __tmp->_M_next;
+ __bin._M_free[__thread_id] -= __removed;
+
+ __gthread_mutex_lock(__bin._M_mutex);
__tmp->_M_next = __bin._M_first[0];
__bin._M_first[0] = __first;
- __bin._M_free[__thread_id] -= __removed;
__gthread_mutex_unlock(__bin._M_mutex);
}
OpenPOWER on IntegriCloud