fix can't find to_string
All checks were successful
linux-mips64-gcc / linux-gcc-mips64el (push) Successful in 1m10s
rpcrypto-build / build (Release, himix200.toolchain.cmake) (push) Successful in 1m20s
linux-x64-gcc / linux-gcc (push) Successful in 2m2s
linux-hisiv500-gcc / linux-gcc-hisiv500 (push) Successful in 1m19s
rpcrypto-build / build (Debug, himix200.toolchain.cmake) (push) Successful in 1m24s
rpcrypto-build / build (Release, hisiv510.toolchain.cmake) (push) Successful in 1m3s
rpcrypto-build / build (Debug, hisiv510.toolchain.cmake) (push) Successful in 1m5s

This commit is contained in:
tqcq 2023-12-28 15:10:26 +08:00
parent 7f0131a9cb
commit 83772e6506
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,4 @@
#include "thread_pool.h" #include "thread_pool.h"
#include <fmt/format.h>
namespace ulib { namespace ulib {
ThreadPool::ThreadPool(int max_thread_num, ThreadPool::ThreadPool(int max_thread_num,

View File

@ -2,6 +2,7 @@
#define ULIB_SRC_ULIB_SYSTEM_THREAD_POOL_H_ #define ULIB_SRC_ULIB_SYSTEM_THREAD_POOL_H_
#include "thread.h" #include "thread.h"
#include <fmt/format.h>
#include "ulib/log/log.h" #include "ulib/log/log.h"
#include "ulib/concorrency/condition_variable.h" #include "ulib/concorrency/condition_variable.h"
#include "ulib/concorrency/mutex.h" #include "ulib/concorrency/mutex.h"
@ -39,7 +40,8 @@ public:
tasks_.emplace([task]() { (*task)(); }); tasks_.emplace([task]() { (*task)(); });
if (tasks_.size() > idle_thread_num_ if (tasks_.size() > idle_thread_num_
&& workers_.size() < max_thread_num_) { && workers_.size() < max_thread_num_) {
AddThread(thread_pool_name_ + std::to_string(workers_.size())); AddThread(thread_pool_name_
+ fmt::format("{}", workers_.size()));
} }
if (tasks_.size() > 1) { if (tasks_.size() > 1) {
tasks_cond_.NotifyAll(); tasks_cond_.NotifyAll();