From: Paolo Carlini Date: Mon, 5 Apr 2004 22:46:04 +0000 (+0000) Subject: mt_allocator.h (__mt_alloc<>::deallocate): The critical section is actually very... X-Git-Tag: releases/gcc-4.0.0~9040 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=268d3b183239c33181a6531b86b3ad911d56147d;p=thirdparty%2Fgcc.git mt_allocator.h (__mt_alloc<>::deallocate): The critical section is actually very small, only two assignments. 2004-04-05 Paolo Carlini * include/ext/mt_allocator.h (__mt_alloc<>::deallocate): The critical section is actually very small, only two assignments. From-SVN: r80439 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8ff1d837c58e..5843ccfbf1f1 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2004-04-05 Paolo Carlini + + * include/ext/mt_allocator.h (__mt_alloc<>::deallocate): + The critical section is actually very small, only two assignments. + 2004-04-04 Paolo Carlini Petur Runolfsson diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h index 401fc3f0d45a..0b17aa2d209f 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(__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); }