(region_view) Removes unique_ptr<thread>
Bug: 77731993
Test: Build and boot oc
Change-Id: Id3ce0bed59021dc8cfa3628c42cdc507656839cf
diff --git a/common/vsoc/lib/region_view.cpp b/common/vsoc/lib/region_view.cpp
index 4fcadc6..dc1088c 100644
--- a/common/vsoc/lib/region_view.cpp
+++ b/common/vsoc/lib/region_view.cpp
@@ -18,8 +18,8 @@
stopping_(false) {}
void vsoc::RegionWorker::start() {
- CHECK(thread_ == nullptr);
- thread_.reset(new std::thread(&vsoc::RegionWorker::Work, this));
+ CHECK(!thread_.joinable());
+ thread_ = std::thread(&vsoc::RegionWorker::Work, this);
}
void vsoc::RegionWorker::Work() {
@@ -37,9 +37,9 @@
vsoc::RegionWorker::~RegionWorker() {
stopping_ = true;
- if (thread_ != nullptr) {
+ if (thread_.joinable()) {
region_->InterruptSelf();
- thread_->join();
+ thread_.join();
}
}
diff --git a/common/vsoc/lib/region_view.h b/common/vsoc/lib/region_view.h
index af089f3..055f721 100644
--- a/common/vsoc/lib/region_view.h
+++ b/common/vsoc/lib/region_view.h
@@ -58,7 +58,7 @@
protected:
std::shared_ptr<RegionControl> control_;
RegionView* region_;
- std::unique_ptr<std::thread> thread_;
+ std::thread thread_;
volatile bool stopping_;
};