Commit 4120e205 authored by Dominik Charousset's avatar Dominik Charousset Committed by Dominik Charousset

Allow the dynamic WDRR queue to disable queues

parent ae4d7c58
......@@ -56,7 +56,6 @@ template <class...> class typed_event_based_actor;
// -- variadic templates with 1 fixed argument ---------------------------------
template <class, class...> class fused_scatterer;
template <class, class...> class annotated_stream;
// -- classes ------------------------------------------------------------------
......
......@@ -106,9 +106,11 @@ public:
bool new_round(long quantum, F& f) {
bool result = false;
for (auto& kvp : qs_) {
if (policy_.enabled(kvp.second)) {
new_round_helper<F> g{kvp.first, kvp.second, f};
result |= g.q.new_round(policy_.quantum(g.q, quantum), g);
}
}
if (!erase_list_.empty()) {
for (auto& k : erase_list_)
qs_.erase(k);
......
......@@ -41,7 +41,6 @@
#include "caf/stream_stage_impl.hpp"
#include "caf/stream_source_impl.hpp"
#include "caf/stream_result_trait.hpp"
#include "caf/broadcast_scatterer.hpp"
#include "caf/terminal_stream_scatterer.hpp"
#include "caf/to_string.hpp"
......
......@@ -258,6 +258,11 @@ struct dmsg_queue_policy : policy_base {
return get<dmsg>(x.content).slots.receiver;
}
template <class Queue>
static inline bool enabled(const Queue&) {
return true;
}
template <class Queue>
deficit_type quantum(const Queue&, deficit_type x) {
return x;
......@@ -483,21 +488,21 @@ struct fixture {
CAF_TEST_FIXTURE_SCOPE(mock_streaming_classes_tests, fixture)
CAF_TEST(simple_handshake) {
bob.start_streaming(alice, 30);
msg_visitor f{&alice};
msg_visitor g{&bob};
while (!alice.mbox.empty() || !bob.mbox.empty()) {
alice.mbox.new_round(1, f);
bob.mbox.new_round(1, g);
CAF_TEST(depth_2_pipeline) {
alice.start_streaming(bob, 30);
msg_visitor f{&bob};
msg_visitor g{&alice};
while (!bob.mbox.empty() || !alice.mbox.empty()) {
bob.mbox.new_round(1, f);
alice.mbox.new_round(1, g);
}
// Check whether alice and bob cleaned up their state properly.
CAF_CHECK(get<2>(alice.mbox.queues()).queues().empty());
// Check whether bob and alice cleaned up their state properly.
CAF_CHECK(get<2>(bob.mbox.queues()).queues().empty());
CAF_CHECK(alice.pending_managers_.empty());
CAF_CHECK(get<2>(alice.mbox.queues()).queues().empty());
CAF_CHECK(bob.pending_managers_.empty());
CAF_CHECK(alice.managers_.empty());
CAF_CHECK(alice.pending_managers_.empty());
CAF_CHECK(bob.managers_.empty());
CAF_CHECK(alice.managers_.empty());
}
CAF_TEST_FIXTURE_SCOPE_END()
This diff is collapsed.
......@@ -89,6 +89,10 @@ struct inode_policy {
return x.value % 3;
}
static inline bool enabled(const queue_type&) {
return true;
}
deficit_type quantum(const queue_type& q, deficit_type x) {
return enable_priorities && *q.policy().queue_id == 0 ? 2 * x : x;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment