|
CAF 0.17.6
|
A Deficit Round Robin queue. More...
#include <drr_queue.hpp>
Public Types | |
| using | super = task_queue< Policy > |
| using | deficit_type = typename policy_type::deficit_type |
| using | policy_type = Policy |
| using | unique_pointer = typename policy_type::unique_pointer |
| using | value_type = typename policy_type::mapped_type |
Public Types inherited from caf::intrusive::task_queue< Policy > | |
| using | policy_type = Policy |
| using | value_type = typename policy_type::mapped_type |
| using | node_type = typename value_type::node_type |
| using | node_pointer = node_type * |
| using | pointer = value_type * |
| using | const_pointer = const value_type * |
| using | reference = value_type & |
| using | const_reference = const value_type & |
| using | unique_pointer = typename policy_type::unique_pointer |
| using | task_size_type = typename policy_type::task_size_type |
| using | iterator = forward_iterator< value_type > |
| using | const_iterator = forward_iterator< const value_type > |
Public Member Functions | |
| drr_queue (policy_type p) | |
| drr_queue (drr_queue &&other) | |
| drr_queue & | operator= (drr_queue &&other) |
| deficit_type | deficit () const |
| void | inc_deficit (deficit_type x) noexcept |
| void | flush_cache () const noexcept |
| template<class F > | |
| bool | consume (F &f) noexcept(noexcept(f(std::declval< value_type & >()))) |
| Consumes items from the queue until the queue is empty or there is not enough deficit to dequeue the next task. | |
| template<class F > | |
| new_round_result | new_round (deficit_type quantum, F &consumer) |
Run a new round with quantum, dispatching all tasks to consumer. | |
Public Member Functions inherited from caf::intrusive::task_queue< Policy > | |
| task_queue (policy_type p) | |
| task_queue (task_queue &&other) | |
| task_queue & | operator= (task_queue &&other) |
| policy_type & | policy () noexcept |
| Returns the policy object. | |
| const policy_type & | policy () const noexcept |
| Returns the policy object. | |
| task_size_type | total_task_size () const noexcept |
| Returns the accumulated size of all stored tasks. | |
| bool | empty () const noexcept |
| Returns whether the queue has no elements. | |
| pointer | peek () noexcept |
| Peeks at the first element in the queue. | |
| template<class F > | |
| void | peek_all (F f) const |
Applies f to each element in the queue. | |
| void | clear () |
| Removes all elements from the queue. | |
| iterator | before_begin () noexcept |
| Returns an iterator to the dummy before the first element. | |
| const_iterator | before_begin () const noexcept |
| Returns an iterator to the dummy before the first element. | |
| iterator | begin () noexcept |
| Returns an iterator to the dummy before the first element. | |
| const_iterator | begin () const noexcept |
| Returns an iterator to the dummy before the first element. | |
| const_iterator | cbegin () const noexcept |
| Returns an iterator to the dummy before the first element. | |
| iterator | end () noexcept |
| Returns a pointer to the dummy past the last element. | |
| const_iterator | end () const noexcept |
| Returns a pointer to the dummy past the last element. | |
| const_iterator | cend () const noexcept |
| Returns a pointer to the dummy past the last element. | |
| pointer | front () noexcept |
| Returns a pointer to the first element. | |
| pointer | back () noexcept |
| Returns a pointer to the last element. | |
| bool | push_back (pointer ptr) noexcept |
Appends ptr to the queue. | |
| bool | push_back (unique_pointer ptr) noexcept |
Appends ptr to the queue. | |
| template<class... Ts> | |
| bool | emplace_back (Ts &&... xs) |
Creates a new element from xs... and appends it. | |
| template<class Container > | |
| void | prepend (Container &other) |
Transfers all element from other to the front of this queue. | |
| template<class Container > | |
| void | append (Container &other) |
Transfers all element from other to the back of this queue. | |
Additional Inherited Members | |
Static Public Member Functions inherited from caf::intrusive::task_queue< Policy > | |
| static pointer | promote (node_pointer ptr) noexcept |
| Casts a node type to its value type. | |
Protected Attributes inherited from caf::intrusive::task_queue< Policy > | |
| node_type | head_ |
| node element pointing to the first element. | |
| node_type | tail_ |
| node element pointing past the last element. | |
| task_size_type | total_task_size_ |
| Stores the total size of all items in the queue. | |
| node_pointer | old_last_ |
| Used for LIFO -> FIFO insertion. | |
| node_pointer | new_head_ |
| Used for LIFO -> FIFO insertion. | |
| policy_type | policy_ |
| Manipulates instances of T. | |
A Deficit Round Robin queue.
|
noexcept |
Consumes items from the queue until the queue is empty or there is not enough deficit to dequeue the next task.
true if f consumed at least one item. | new_round_result caf::intrusive::drr_queue< Policy >::new_round | ( | deficit_type | quantum, |
| F & | consumer | ||
| ) |
Run a new round with quantum, dispatching all tasks to consumer.
true if at least one item was consumed, false otherwise.