summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/src
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-06 16:31:19 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-06 16:31:19 +0000
commit434a6c129085df4a763c274210d9f94f351dccb7 (patch)
treec9ecff4c550fca02d9673950e0c6ef37f49058ac /libstdc++-v3/src
parent51e7cf455ebc03e11c7c97dda89443da7732170c (diff)
downloadppe42-gcc-434a6c129085df4a763c274210d9f94f351dccb7.tar.gz
ppe42-gcc-434a6c129085df4a763c274210d9f94f351dccb7.zip
2004-10-06 Benjamin Kosnik <bkoz@redhat.com>
Paolo Carlini <pcarlini@suse.de> PR libstdc++/17780 * src/mt_allocator.cc (__pool<true>::_M_reserve_block): Revert to old locking order. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88611 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r--libstdc++-v3/src/mt_allocator.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/libstdc++-v3/src/mt_allocator.cc b/libstdc++-v3/src/mt_allocator.cc
index 066726b0367..1e45f4cfb1b 100644
--- a/libstdc++-v3/src/mt_allocator.cc
+++ b/libstdc++-v3/src/mt_allocator.cc
@@ -298,10 +298,13 @@ namespace __gnu_cxx
_Block_record* __block = NULL;
if (__gthread_active_p())
{
+ __gthread_mutex_lock(__bin._M_mutex);
if (__bin._M_first[0] == NULL)
{
// No need to hold the lock when we are adding a whole
// chunk to our own list.
+ __gthread_mutex_unlock(__bin._M_mutex);
+
void* __v = ::operator new(__options._M_chunk_size);
__bin._M_first[__thread_id] = static_cast<_Block_record*>(__v);
__bin._M_free[__thread_id] = __block_count;
@@ -327,7 +330,6 @@ namespace __gnu_cxx
// Is the number of required blocks greater than or equal
// to the number that can be provided by the global free
// list?
- __gthread_mutex_lock(__bin._M_mutex);
__bin._M_first[__thread_id] = __bin._M_first[0];
if (__block_count >= __bin._M_free[0])
{
OpenPOWER on IntegriCloud