Commit 8f7f677d authored by Lara Lu's avatar Lara Lu Committed by Facebook Github Bot

fix coro example in readme

Summary: was reading coro example and i think a line is missing

Reviewed By: andriigrynenko

Differential Revision: D13788989

fbshipit-source-id: ceb024a36ddd89369ee25f6632fce8d339c489cb
parent 8946c3b5
......@@ -36,6 +36,7 @@ folly::SemiFuture<int> task42() {
folly::SemiFuture<int> taskSlow43() {
return folly::futures::sleep(std::chrono::seconds{1})
.semi()
.deferValue([](auto) { return task42(); })
.deferValue([](auto value) { return value + 1; });
}
......@@ -91,7 +92,7 @@ void runCoroutine1() {
}
void runCoroutine2() {
folly::SemiFuture<folly::Unit> f =
folly::SemiFuture<folly::Unit> f =
checkArg(42).scheduleOn(folly::getCPUExecutor().get()).start();
}
```
......@@ -106,7 +107,7 @@ folly::coro::Task<int> task42Slow() {
// This doesn't suspend the coroutine, just extracts the Executor*
folly::Executor* startExecutor = co_await folly::coro::co_current_executor;
co_await folly::futures::sleep(std::chrono::seconds{1});
folly::Executor* resumeExecutor = co_await folly::coro::co_current_executor;
folly::Executor* resumeExecutor = co_await folly::coro::co_current_executor;
CHECK_EQ(startExecutor, resumeExecutor);
}
```
......@@ -206,4 +207,4 @@ folly::SemiFuture<Reply> semifuture_send(const Request& request) {
return std::move(task).semi();
}
```
\ No newline at end of file
```
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment