Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/UtilsCtrl/ThreadPool/Thread/UThreadBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class UThreadBase : public UThreadObject {
protected:
CBool done_; // 线程状态标记
CBool is_init_; // 标记初始化状态
std::atomic<bool> is_running_; // 是否正在执行
std::atomic<bool> is_running_ { false }; // 是否正在执行
CInt type_ = 0; // 用于区分线程类型(主线程、辅助线程)
CULong total_task_num_ = 0; // 处理的任务的数字

Expand Down
18 changes: 8 additions & 10 deletions src/UtilsCtrl/ThreadPool/UThreadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,19 +295,17 @@ CVoid UThreadPool::monitor() {

CSize UThreadPool::wakeupAllThread() {
CSize size = 0;
if (wakeup_mutex_.try_lock()) {
for (auto* pt : primary_threads_) {
if (pt->wakeup()) {
++size;
}
CGRAPH_LOCK_GUARD lock(wakeup_mutex_);
for (auto* pt : primary_threads_) {
if (pt->wakeup()) {
++size;
}
}

for (const auto& st : secondary_threads_) {
if (st->wakeup()) {
++size;
}
for (const auto& st : secondary_threads_) {
if (st->wakeup()) {
++size;
}
wakeup_mutex_.unlock();
}

return size;
Expand Down
Loading