This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, This patch re-does the allocate function loop which adds blocks from the global free list to the current one. -- -Dhruv Matani. http://www.geocities.com/dhruvbird/ Proud to be a Vegetarian. http://www.vegetarianstarterkit.com/ http://www.vegkids.com/vegkids/index.html
Attachment:
ChangeLog
Description: Text document
*** mt_allocator.h 2004-04-06 04:16:04.000000000 +0530 --- /home/dhruv/projects/new_libstdc++-v3/include/ext/mt_allocator.h 2004-04-11 23:19:41.000000000 +0530 *************** namespace __gnu_cxx *** 345,362 **** } else { ! while (__bin._M_first[0] != NULL && __block_count > 0) ! { ! _Block_record* __tmp = __bin._M_first[0]->_M_next; ! __block = __bin._M_first[0]; ! __block->_M_next = __bin._M_first[__thread_id]; ! __bin._M_first[__thread_id] = __block; ! ! ++__bin._M_free[__thread_id]; ! __bin._M_first[0] = __tmp; --__block_count; } __gthread_mutex_unlock(__bin._M_mutex); } } --- 345,368 ---- } else { ! // At least 1 block exists. ! _Block_record* __first = __bin._M_first[0]; ! _Block_record* __tmp = __first; ! size_t __added = __block_count; ! --__block_count; ! while (__tmp->_M_next && __block_count > 0) ! { ! __tmp = __tmp->_M_next; --__block_count; } + + __added = __added - __block_count; + __bin._M_first[0] = __tmp->_M_next; + __tmp->_M_next = __bin._M_first[__thread_id]; + __bin._M_free[__thread_id] += __added; + __bin._M_first[__thread_id] = __first; + __gthread_mutex_unlock(__bin._M_mutex); } }
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |