StaticThreadPipeline
This commit is contained in:
@@ -18,10 +18,12 @@ struct Message {
|
||||
|
||||
struct EchoHandler : public ConnectionHandler {
|
||||
private:
|
||||
ThreadPipeline<Message> &pipeline;
|
||||
StaticThreadPipeline<Message, WaitStrategy::WaitIfStageEmpty, 1> &pipeline;
|
||||
|
||||
public:
|
||||
explicit EchoHandler(ThreadPipeline<Message> &pipeline)
|
||||
explicit EchoHandler(
|
||||
StaticThreadPipeline<Message, WaitStrategy::WaitIfStageEmpty, 1>
|
||||
&pipeline)
|
||||
: pipeline(pipeline) {}
|
||||
|
||||
void on_data_arrived(std::string_view data,
|
||||
@@ -42,11 +44,11 @@ TEST_CASE(
|
||||
config.server.io_threads = 1;
|
||||
config.server.epoll_instances = 1;
|
||||
|
||||
ThreadPipeline<Message> pipeline{10, {1}};
|
||||
StaticThreadPipeline<Message, WaitStrategy::WaitIfStageEmpty, 1> pipeline{10};
|
||||
EchoHandler handler{pipeline};
|
||||
auto echoThread = std::thread{[&]() {
|
||||
for (;;) {
|
||||
auto guard = pipeline.acquire(0, 0);
|
||||
auto guard = pipeline.acquire<0, 0>();
|
||||
for (auto &message : guard.batch) {
|
||||
bool done = message.done;
|
||||
if (done) {
|
||||
|
||||
Reference in New Issue
Block a user