| 23 | using ms = std::chrono::milliseconds; |
| 24 | |
| 25 | TEST(GenericFuture, MakeFutureInCoroutineAndMainThread) |
| 26 | { |
| 27 | Dispatcher& dispatcher = DispatcherSingleton::instance({false, false}); |
| 28 | GenericFuture<int> threadFuture = dispatcher.post([](VoidContextPtr ctx)->int { |
| 29 | //post an IO task and get future from there |
| 30 | GenericFuture<int> coroFuture(ctx->postAsyncIo([]()->int { |
| 31 | return 33; |
| 32 | }), ctx); |
| 33 | return coroFuture.get(); //forward the promise to main thread |
| 34 | }); |
| 35 | EXPECT_EQ(33, threadFuture.get()); //block until value is available |
| 36 | } |
| 37 | |
| 38 | TEST(GenericFuture, WaitForCoroutineFutureInIoTask) |
| 39 | { |
nothing calls this directly
no test coverage detected