Fixed ~ThreadStatusImpl().

This commit is contained in:
Yueh-Hsuan Chiang 2014-11-20 15:45:56 -08:00
parent fbc42a0933
commit beabc6879c

View File

@ -21,13 +21,7 @@ std::unordered_map<const void*, std::unordered_set<const void*>>
ThreadStatusImpl::db_key_map_;
ThreadStatusImpl::~ThreadStatusImpl() {
std::lock_guard<std::mutex> lck(thread_list_mutex_);
for (auto* thread_data : thread_data_set_) {
assert(thread_data->thread_type == ThreadStatus::ThreadType::USER_THREAD);
delete thread_data;
}
assert(thread_data_set_.size() == 0);
thread_data_set_.clear();
}
void ThreadStatusImpl::UnregisterThread() {
@ -35,6 +29,7 @@ void ThreadStatusImpl::UnregisterThread() {
std::lock_guard<std::mutex> lck(thread_list_mutex_);
thread_data_set_.erase(thread_status_data_);
delete thread_status_data_;
thread_status_data_ = nullptr;
}
}