mymangosd/third_party/f8/f8/threadpool.h
aozhiwei fb6dd34caa 1
2024-12-24 18:41:50 +08:00

28 lines
541 B
C++

#pragma once
namespace f8
{
class ThreadPool
{
public:
class Context
{
public:
virtual bool* Terminated() = 0;
virtual list_head* GetWorkList() = 0;
virtual void Wait(int ms) = 0;
};
void Init(int thread_num, std::function<void(Context*)> cb);
void UnInit();
void Start();
void PostMsg(int key, list_head* node);
private:
class WorkerThread;
std::vector<std::shared_ptr<WorkerThread>> threads_;
};
}