整理代码

This commit is contained in:
蒲爽 2026-09-28 21:33:04 +08:00
commit c7b4e178ec
364 changed files with 59691 additions and 0 deletions

35
util/ParallelRunner.h Normal file
View file

@ -0,0 +1,35 @@
#ifndef DE82057F_5520_4849_8108_E9A31AAC1878
#define DE82057F_5520_4849_8108_E9A31AAC1878
/*
*******************************************************************************
* INCLUDE
*******************************************************************************
*/
#include <functional>
#include <Poco/Thread.h>
#include <Poco/SharedPtr.h>
namespace Util
{
/*
*******************************************************************************
* CLASS DECLARE
*******************************************************************************
*/
class ParallelRunner
{
public:
template <class Func, class... Args> void run(Func func, Args... args)
{
Poco::Thread* pThread = new Poco::Thread();
pThread->startFunc([=]() -> void { func(args...); });
_threads.push_back(pThread);
}
void join();
private:
std::vector<Poco::SharedPtr<Poco::Thread>> _threads;
};
}
#endif