Skip to content

Commit

Permalink
Update future.zh-cn.md
Browse files Browse the repository at this point in the history
  • Loading branch information
c8ef authored Oct 28, 2024
1 parent fc32d89 commit bec3e7e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/future.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ using ::babylon::Promise;
::std::thread thread([&]() {
// 异步做一些事情
...
// 最终赋值
promise.set_value(10086);
// 最终赋值
promise.set_value(10086);
});
future.get(); // 等待set_value,结果 == 10086
}
Expand All @@ -39,8 +39,8 @@ using ::babylon::Promise;
XThread thread([&]() {
// 异步做一些事情
...
// 最终赋值
promise.set_value(10086);
// 最终赋值
promise.set_value(10086);
});
future.get(); // 等待set_value(使用XSchedInterface协程同步,不占用pthread
// worker),结果 == 10086
Expand All @@ -53,8 +53,8 @@ using ::babylon::Promise;
::std::thread thread([promise = ::std::move(promise)]() mutable {
// 异步做一些事情
...
// 最终赋值
promise.set_value(10086);
// 最终赋值
promise.set_value(10086);
});
Promise<int> promise2;
auto future2 = promise2.get_future();
Expand Down

0 comments on commit bec3e7e

Please sign in to comment.