Jia Yue Hua

贾跃华

马上订阅 Jia Yue Hua RSS 更新: https://www.jiayuehua.com/feed.xml

使用mpmcpipeline和jthread实现软流水

2023年5月22日 08:00

多个Jthread线程,每个线程完成mpmcpipeline中一个stage的处理,实现软件流水。第一个stage收到sentinal value时,所有work线程都退出。

#include <gtest/gtest.h>
#include <folly/MPMCPipeline.h>
#include <vector>
#include <thread>
#include <boost/mp11.hpp>
#include <fmt/format.h>
#include <folly/Function.h>
#include <type_traits>
#include <boost/hana.hpp>
namespace mp11 = boost::mp11;
namespace hana = boost::hana;

template <class T>
struct getNumber {
  constexpr int operator()(int n) const noexcept { return n; }
};...

剩余内容已隐藏

查看完整文章以阅读更多