Skip to content

fix: 并发章节错别字 #1414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion swift-6.docc/LanguageGuide/Concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ extension TemperatureLogger {

## 可发送类型

任务和 actor 能让你将一个程序分成多个小段病安全地并行运行。一个任务或是一个 actor 的实例内部所包含的可变状态(例如变量或属性),被称为*并发域*。有些数据无法在不同的并发域之间共享,因为这些数据包含可变状态,但其又无法对重叠访问提供保护。
任务和 actor 能让你将一个程序分成多个小段并安全地并行运行。一个任务或是一个 actor 的实例内部所包含的可变状态(例如变量或属性),被称为*并发域*。有些数据无法在不同的并发域之间共享,因为这些数据包含可变状态,但其又无法对重叠访问提供保护。

对于可以被从一个并发域共享到另一个并发域的类型,被称作*可发送类型*。例如,它可以在调用一个 actor 时被作为参数传递,或是作为一项任务的返回值返回。本章前述的几个例子没有讨论可发送性,因为这些例子使用的都是简单的值类型,而这些类型永远是可以被安全地在并发域之前传递的。相比之下,有些类型无法被安全地在并发域之间传递。比如,一个包含了可变属性、但又没有添加串行访问保护的类,如果在不同任务之间传递,可能会产生无法预测或是错误的结果。

Expand Down