Background thread that runs blocking socket I/O and HTTP jobs. Completions are queued and drained by Network::pump on the main thread. 更多...
#include <NetWorker.h>
Public 成员函数 | |
| NetWorker (Network *owner) | |
Creates a worker owned by owner (not started yet). | |
| ~NetWorker () | |
| void | start () |
| Starts the worker thread. | |
| void | stop () |
| Stops the worker thread and joins it. | |
| void | post (NetCompletion c) |
| Queues a completion for the main thread (thread-safe). | |
| void | drain (std::vector< NetCompletion > &out) |
| Test helper: moves all pending completions into out. | |
| void | submit (std::function< void()> job) |
| Queues an arbitrary blocking job to run on the worker thread. | |
详细描述
Background thread that runs blocking socket I/O and HTTP jobs. Completions are queued and drained by Network::pump on the main thread.
在文件 NetWorker.h 第 20 行定义.
构造及析构函数说明
◆ NetWorker()
|
explicit |
Creates a worker owned by owner (not started yet).
在文件 NetWorker.cpp 第 8 行定义.
◆ ~NetWorker()
| eve::network::NetWorker::~NetWorker | ( | ) |
在文件 NetWorker.cpp 第 10 行定义.
引用了 stop().
成员函数说明
◆ drain()
| void eve::network::NetWorker::drain | ( | std::vector< NetCompletion > & | out | ) |
Test helper: moves all pending completions into out.
在文件 NetWorker.cpp 第 35 行定义.
◆ post()
| void eve::network::NetWorker::post | ( | NetCompletion | c | ) |
◆ start()
| void eve::network::NetWorker::start | ( | ) |
Starts the worker thread.
在文件 NetWorker.cpp 第 14 行定义.
◆ stop()
| void eve::network::NetWorker::stop | ( | ) |
◆ submit()
| void eve::network::NetWorker::submit | ( | std::function< void()> | job | ) |
Queues an arbitrary blocking job to run on the worker thread.
在文件 NetWorker.cpp 第 40 行定义.
被这些函数引用 eve::network::TcpSocket::connect(), eve::network::UdpSocket::send() , 以及 eve::network::UdpSocket::sendTo().
该类的文档由以下文件生成:
- src/modules/network/NetWorker.h
- src/modules/network/NetWorker.cpp