2
3
4
5
8#include "Core/Thread/ThreadPoolBasic.h"
10#include "Core/Thread/Semaphore.h"
17
18
23 using ThreadInitCallback = std::function<
void(
EventLoop*)>;
28
29
30
31
40
41
45
46
47
51
52
53
57
58
59
60 const std::string&
Name()
const {
return m_PoolName; }
63
64
65
69
70
71
72
73 void Start(
int initThreadSize = 3, ThreadInitCallback cb =
nullptr);
78
79
83
84
88
89
93
94
98
99
#define SPICES_PROFILE_ZONE
ThreadInitCallback m_ThreadInitCallback
ThreadInitCallback.
EventLoop * GetNextLoop()
Get next thread EventLoop.
InetAddress m_ListenAddress
ListenAddress.
std::vector< EventLoop * > GetAllLoops()
Get all thread EventLoop.
int m_Next
Next EventLoop index.
semaphore m_IsThreadsPrepared
ThreadsPrepared condition.
void ThreadFunc(Thread<> *thread)
Thread Function.
EventLoopThreadPool(const InetAddress &listenAddress)
Constructor Function. Create Specific ThreadPool.
void Start(int initThreadSize=3, ThreadInitCallback cb=nullptr)
Start Run this thread pool.
std::vector< EventLoop * > m_Loops
All threads EventLoop collection.
const std::string & Name() const
Get ThreadPool Name.
virtual ~EventLoopThreadPool() override=default
Destructor Function.
ThreadPool of Multiple threading EventLoop.
static EventLoop *& GetInst(InetAddress *address=nullptr)
Get EventLoop Instance. @reutrn Returns EventLoop Instance.
Wrapper of Instance/Delete ThreadCache in thread.
void Loop()
Start Event Loop.
Wrapper of Poller and wakeup socket to acceptor(SubLoop).
This class is Wrapper of current socket address.
static bool SetThreadName(const std::string &name)
Set Thread name.
Thread Static Function Library.
std::semaphore Implementation.