forked from boostorg/smart_ptr
Fixed a deadlock in free_unreachable_objects.
[SVN r17090]
This commit is contained in:
@ -195,25 +195,27 @@ static void scan_and_free(void * area, size_t size, map2_type const & m2, free_l
|
|||||||
|
|
||||||
void free_unreachable_objects()
|
void free_unreachable_objects()
|
||||||
{
|
{
|
||||||
map2_type m2;
|
free_list_type free;
|
||||||
|
|
||||||
|
{
|
||||||
|
map2_type m2;
|
||||||
|
|
||||||
#ifdef BOOST_HAS_THREADS
|
#ifdef BOOST_HAS_THREADS
|
||||||
|
|
||||||
mutex_type::scoped_lock lock(get_mutex());
|
mutex_type::scoped_lock lock(get_mutex());
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
map_type const & m = get_map();
|
map_type const & m = get_map();
|
||||||
|
|
||||||
find_unreachable_objects_impl(m, m2);
|
find_unreachable_objects_impl(m, m2);
|
||||||
|
|
||||||
free_list_type free;
|
for(map2_type::iterator j = m2.begin(); j != m2.end(); ++j)
|
||||||
|
{
|
||||||
for(map2_type::iterator j = m2.begin(); j != m2.end(); ++j)
|
map_type::const_iterator i = m.find(j->first);
|
||||||
{
|
BOOST_ASSERT(i != m.end());
|
||||||
map_type::const_iterator i = m.find(j->first);
|
scan_and_free(i->second.first, i->second.second, m2, free);
|
||||||
BOOST_ASSERT(i != m.end());
|
}
|
||||||
scan_and_free(i->second.first, i->second.second, m2, free);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "... about to free " << free.size() << " objects.\n";
|
std::cout << "... about to free " << free.size() << " objects.\n";
|
||||||
|
Reference in New Issue
Block a user