MCPcopy Create free account
hub / github.com/AlexInLog/ReactivePlusPlus / simulate_nested_scheduling

Function simulate_nested_scheduling

src/tests/rpp/test_scheduler.cpp:43–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43static std::string simulate_nested_scheduling(auto worker, const auto& obs, std::vector<std::string>& out)
44{
45 std::thread thread([&, worker] {
46 worker.schedule([&, worker](const auto&) {
47 out.push_back("Task 1 starts "s + get_thread_id_as_string());
48
49 worker.schedule([&, worker](const auto&) {
50 out.push_back("Task 2 starts "s + get_thread_id_as_string());
51
52 worker.schedule([&](const auto&) {
53 out.push_back("Task 3 runs "s + get_thread_id_as_string());
54 return rpp::schedulers::optional_delay_from_now{};
55 },
56 obs);
57
58 out.push_back("Task 2 ends "s + get_thread_id_as_string());
59 return rpp::schedulers::optional_delay_from_now{};
60 },
61 obs);
62
63 out.push_back("Task 1 ends "s + get_thread_id_as_string());
64 return rpp::schedulers::optional_delay_from_now{};
65 },
66 obs);
67 });
68
69 auto threadid = get_thread_id_as_string(thread.get_id());
70 thread.join();
71 return threadid;
72}
73
74static std::string simulate_complex_scheduling(const auto& worker, const auto& obs, std::vector<std::string>& out)
75{

Callers 1

test_scheduler.cppFile · 0.85

Calls 3

get_thread_id_as_stringFunction · 0.85
scheduleMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected