| 77 | }; |
| 78 | |
| 79 | TEST_F(UthreadTest, testSimple) { |
| 80 | auto show = [&](const std::string& message) mutable { |
| 81 | std::cout << message << "\n"; |
| 82 | }; |
| 83 | std::atomic<bool> done(false); |
| 84 | _executor.schedule([&done, ex = &_executor, &show]() { |
| 85 | Uthread ut(Attribute{ex}, [&show]() { show("task 1"); }); |
| 86 | ut.join([ex, &done, &show]() { |
| 87 | show("task 1 done"); |
| 88 | ex->schedule([ex, &done, &show]() { |
| 89 | Uthread ut(Attribute{ex}, [&show]() { show("task 2"); }); |
| 90 | ut.join([&done, &show]() { |
| 91 | show("task 2 done"); |
| 92 | done = true; |
| 93 | }); |
| 94 | }); |
| 95 | }); |
| 96 | }); |
| 97 | while (!done) { |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | TEST_F(UthreadTest, testSwitch) { |
| 102 | Executor* ex = &_executor; |
nothing calls this directly
no test coverage detected