#include <priority_queue.hpp>
|
bool | canBorrowThread () |
| Queue can borrow reserved thread from one of the other priority queues but each queue must have at least 1 thread reserved all the time even if has nothing to do. More...
|
|
◆ PriorityQueue()
taraxa::network::threadpool::PriorityQueue::PriorityQueue |
( |
size_t |
tp_workers_count, |
|
|
const addr_t & |
node_addr = {} |
|
) |
| |
◆ canBorrowThread()
bool taraxa::network::threadpool::PriorityQueue::canBorrowThread |
( |
| ) |
|
|
private |
Queue can borrow reserved thread from one of the other priority queues but each queue must have at least 1 thread reserved all the time even if has nothing to do.
- Returns
- true if thread can be borrowed, otherwise false
◆ empty()
bool taraxa::network::threadpool::PriorityQueue::empty |
( |
| ) |
const |
- Returns
- true of all priority packets_queues_ are empty, otheriwse false
◆ getPrirotityQueueSize()
Returns specified priority queue actual size.
- Parameters
-
- Returns
- size_t
◆ isNonBlockingPacket()
bool taraxa::network::threadpool::PriorityQueue::isNonBlockingPacket |
( |
SubprotocolPacketType |
packet_type | ) |
const |
- Parameters
-
- Returns
- true for non-blocking packet types, otherwise false
◆ pop()
- Returns
- std::optional<PacketData> packet with the highest priority & oldest "receive" time
◆ pushBack()
Pushes new packet into the priority queue.
- Parameters
-
◆ updateBlockingDependencies()
bool taraxa::network::threadpool::PriorityQueue::updateBlockingDependencies |
( |
const PacketData & |
packet, |
|
|
bool |
unblock_processing = false |
|
) |
| |
Updates packet blocking dependency.
- Parameters
-
packet | |
unblock_processing | if true, unblock packet processing, otherwise block processing |
- Returns
- true if blocking dependency for provided packet was updated, otherwise false
◆ updateDependenciesFinish()
void taraxa::network::threadpool::PriorityQueue::updateDependenciesFinish |
( |
const PacketData & |
packet, |
|
|
std::mutex & |
queue_mutex, |
|
|
std::condition_variable & |
cond_var |
|
) |
| |
Updates blocking dependencies after packet processing is done.
- Parameters
-
packet | |
queue_mutex_ | must be locked if processing also blocking dependencies |
cond_var | notify function is called if processing also blocking dependencies |
◆ updateDependenciesStart()
void taraxa::network::threadpool::PriorityQueue::updateDependenciesStart |
( |
const PacketData & |
packet | ) |
|
Updates blocking dependencies at the start of packet processing.
- Parameters
-
◆ act_total_workers_count_
std::atomic<size_t> taraxa::network::threadpool::PriorityQueue::act_total_workers_count_ |
|
private |
◆ blocked_packets_mask_
◆ MAX_TOTAL_WORKERS_COUNT
const size_t taraxa::network::threadpool::PriorityQueue::MAX_TOTAL_WORKERS_COUNT |
|
private |
◆ packets_queues_
Initial value:{PacketsQueue(), PacketsQueue(),
PacketsQueue()}
The documentation for this class was generated from the following files: