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