|
trantor
Non-blocking I/O cross-platform TCP network library, using C++14
|
This class represents a pool of EventLoopThread objects. More...
#include <trantor/net/EventLoopThreadPool.h>


Public Member Functions | |
| EventLoopThreadPool (size_t threadNum, const std::string &name="EventLoopThreadPool") | |
| Construct a new event loop thread pool instance. | |
| void | start () |
| Run all event loops in the pool. | |
| void | wait () |
| Wait for all event loops in the pool to quit. | |
| size_t | size () |
| Return the number of the event loop. | |
| EventLoop * | getNextLoop () |
| Get the next event loop in the pool. | |
| EventLoop * | getLoop (size_t id) |
| Get the event loop in the id position in the pool. | |
| std::vector< EventLoop * > | getLoops () const |
| Get all event loops in the pool. | |
This class represents a pool of EventLoopThread objects.
| trantor::EventLoopThreadPool::EventLoopThreadPool | ( | size_t | threadNum, |
| const std::string & | name = "EventLoopThreadPool" ) |
Construct a new event loop thread pool instance.
| threadNum | The number of threads |
| name | The name of the EventLoopThreadPool object. |
| EventLoop * trantor::EventLoopThreadPool::getLoop | ( | size_t | id | ) |
Get the event loop in the id position in the pool.
| id | The id of the first event loop is zero. If the id >= the number of event loops, nullptr is returned. |
| std::vector< EventLoop * > trantor::EventLoopThreadPool::getLoops | ( | ) | const |
Get all event loops in the pool.
| EventLoop * trantor::EventLoopThreadPool::getNextLoop | ( | ) |
Get the next event loop in the pool.
|
inline |
Return the number of the event loop.
| void trantor::EventLoopThreadPool::start | ( | ) |
Run all event loops in the pool.
| void trantor::EventLoopThreadPool::wait | ( | ) |
Wait for all event loops in the pool to quit.