This commit is contained in:
Michael Kolupaev 2013-02-22 12:18:08 +00:00
parent 9f60383fee
commit a4fe773cba
2 changed files with 10 additions and 6 deletions

View File

@ -52,6 +52,11 @@ public:
return ptr->storage.get();
}
size_t use_count() const
{
return ptr.use_count();
}
bool operator == (const IStorage * p) const
{
return get() == p;

View File

@ -151,16 +151,15 @@ void StorageChunkMerger::dropImpl()
StorageChunkMerger::~StorageChunkMerger()
{
if (!thread_should_quit)
{
thread_should_quit = true;
merge_thread.join();
}
merge_thread.detach();
}
void StorageChunkMerger::mergeThread()
{
while (!thread_should_quit)
/// Не дает удалить this посреди итерации.
StoragePtr this_ptr = thisPtr();
while (!thread_should_quit && this_ptr.use_count() > 1)
{
bool merged = false;
bool error = true;