PacketsThreadPool for concurrent packets processing.
More...
#include <tarcap_thread_pool.hpp>
PacketsThreadPool for concurrent packets processing.
◆ PacketsThreadPool() [1/3]
taraxa::network::threadpool::PacketsThreadPool::PacketsThreadPool |
( |
size_t |
workers_num = 10 , |
|
|
const addr_t & |
node_addr = {} |
|
) |
| |
- Parameters
-
workers_num | Number of workers |
◆ ~PacketsThreadPool()
taraxa::network::threadpool::PacketsThreadPool::~PacketsThreadPool |
( |
| ) |
|
◆ PacketsThreadPool() [2/3]
taraxa::network::threadpool::PacketsThreadPool::PacketsThreadPool |
( |
const PacketsThreadPool & |
| ) |
|
|
delete |
◆ PacketsThreadPool() [3/3]
taraxa::network::threadpool::PacketsThreadPool::PacketsThreadPool |
( |
PacketsThreadPool && |
| ) |
|
|
delete |
◆ getQueueSize()
std::tuple< size_t, size_t, size_t > taraxa::network::threadpool::PacketsThreadPool::getQueueSize |
( |
| ) |
const |
Returns actual size of all priority queues (thread-safe)
- Returns
- std::tuple<size_t, size_t, size_t> - > std::tuple<HighPriorityQueue.size(), MidPriorityQueue.size(), LowPriorityQueue.size()>
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ processPacket()
void taraxa::network::threadpool::PacketsThreadPool::processPacket |
( |
size_t |
worker_id | ) |
|
Threadpool sycnchronized processing function, which internally calls packet-specific handlers.
Threadpool sycnchronized processing function, which calls user-defined custom processing function.
◆ push()
Push the given element value to the end of the queue. Used for r-values.
Pushes the given element value to the end of the queue. Used for r-values.
- Returns
- packet unique ID. In case push was not successful, empty optional is returned
◆ setPacketsHandlers()
Sets packet handler.
- Parameters
-
◆ startProcessing()
void taraxa::network::threadpool::PacketsThreadPool::startProcessing |
( |
| ) |
|
Start all processing threads.
◆ stopProcessing()
void taraxa::network::threadpool::PacketsThreadPool::stopProcessing |
( |
| ) |
|
Stop all processing threads.
◆ cond_var_
std::condition_variable taraxa::network::threadpool::PacketsThreadPool::cond_var_ |
|
private |
◆ packets_count_
uint64_t taraxa::network::threadpool::PacketsThreadPool::packets_count_ {0} |
|
private |
◆ packets_handlers_
◆ queue_
PriorityQueue taraxa::network::threadpool::PacketsThreadPool::queue_ |
|
private |
◆ queue_mutex_
std::mutex taraxa::network::threadpool::PacketsThreadPool::queue_mutex_ |
|
private |
◆ stopProcessing_
std::atomic<bool> taraxa::network::threadpool::PacketsThreadPool::stopProcessing_ {false} |
|
private |
◆ workers_
std::vector<std::thread> taraxa::network::threadpool::PacketsThreadPool::workers_ |
|
private |
◆ workers_num_
LOG_OBJECTS_DEFINE const size_t taraxa::network::threadpool::PacketsThreadPool::workers_num_ |
|
private |
The documentation for this class was generated from the following files: