17 #include <boost/thread/barrier.hpp> 20 using namespace folly;
26 auto node = std::make_unique<TestNode>(
this);
27 auto handle = node->handle;
34 std::unordered_set<Handle> memo;
35 for (
auto& node : nodes) {
36 for (Handle handle : node.second->dependencies) {
40 for (
auto& node : nodes) {
41 if (memo.find(node.first) == memo.end()) {
42 source_node = node.first;
45 for (
auto it = nodes.cbegin(); it != nodes.cend();) {
46 if (it->first != source_node) {
55 void remove(Handle
a) {
56 for (
auto& node : nodes) {
57 node.second->dependencies.erase(
a);
64 nodes.at(b)->dependencies.insert(a);
65 dag->dependency(a, b);
70 for (
auto& kv : nodes) {
71 auto handle = kv.first;
72 auto& node = kv.second;
73 auto it =
order.begin();
74 while (*it != handle) {
77 for (
auto dep : node->dependencies) {
86 test->
order.push_back(handle);
89 handle(
test->dag->add(func)) {}
97 std::map<Handle, std::unique_ptr<TestNode>>
nodes;
214 return makeFuture<Unit>(std::runtime_error(
"oops"));
220 dag->dependency(h1, h2);
227 dag->dependency(h1, h2);
256 auto barrier = std::make_shared<boost::barrier>(2);
260 auto h1 = localDag->add([barrier] {
261 auto p = std::make_shared<Promise<Unit>>();
262 std::thread
t([p, barrier] {
267 return p->getFuture();
270 localDag->dependency(h1, h2);
#define EXPECT_THROW(statement, expected_exception)
std::set< Handle > dependencies
#define EXPECT_EQ(val1, val2)
constexpr detail::Map< Move > move
—— Concurrent Priority Queue Implementation ——
std::function< Future< Unit >)> FutureFunc
static std::shared_ptr< FutureDAG > create()
void dependency(Handle a, Handle b)
TEST_F(AsyncSSLSocketWriteTest, write_coalescing1)
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
std::vector< Handle > order
#define EXPECT_TRUE(condition)
FutureDAG::FutureFunc throwFunc
TestNode(FutureDAGTest *test)
FutureDAG::FutureFunc makeFutureFunc
std::map< Handle, std::unique_ptr< TestNode > > nodes
const FutureDAG::FutureFunc func
#define ASSERT_NO_THROW(statement)
Future< typename std::decay< T >::type > makeFuture(T &&t)