@@ -11,7 +11,7 @@ Swift Memory and Concurrency Model
11
11
12
12
The goal of this writeup is to provide a safe and efficient way to model,
13
13
design, and implement concurrent applications in Swift. It is believed that it
14
- will completely eliminate data races and reduce deadlocks in swift apps, and
14
+ will completely eliminate data races and reduce deadlocks in Swift apps, and
15
15
will allow for important performance wins as well. This happens by eliminating
16
16
shared mutable data, locks, and the need for most atomic memory accesses. The
17
17
model is quite different from what traditional unix folks are used to
@@ -83,7 +83,7 @@ definition. These kinds are:
83
83
b.list.data = 42 // error, can't change immutable data.
84
84
85
85
As part of mutable data, it is worth pointing out that mutable "global
86
- variables" in swift are not truly global, they are local to the current actor
86
+ variables" in Swift are not truly global, they are local to the current actor
87
87
(somewhat similar to "thread local storage", or perhaps to "an ivar on the
88
88
actor"). Immutable global variables (like lookup tables) are simple immutable
89
89
data just like today. Global variables with "static constructors /
@@ -225,7 +225,7 @@ Performing synchronous operations
225
225
---------------------------------
226
226
227
227
Asynchronous calls are nice and define away the possibility of deadlock, but at
228
- some point you need to get a return value back and async programming is very
228
+ some point, you need to get a return value back and async programming is very
229
229
awkward. To handle this, a 'synch' block is used. For example, the following is
230
230
valid::
231
231
@@ -245,7 +245,7 @@ context.
245
245
Memory Ownership Model
246
246
----------------------
247
247
248
- Within an actor there is a question of how ownership is handled. It's not in the
248
+ Within an actor, there is a question of how ownership is handled. It's not in the
249
249
scope of this document to say what the "one true model" is, but here are a
250
250
couple of interesting observations:
251
251
@@ -265,7 +265,7 @@ couple of interesting observations:
265
265
stop the world to do a collection. 2) actors have natural local quiescent
266
266
points: when they have finished servicing a message, if their dispatch queue
267
267
is empty, they go to sleep. If nothing else in the CPU needs the thread, it
268
- would be a natural time to collect. 3) GC would be fully precise in swift ,
268
+ would be a natural time to collect. 3) GC would be fully precise in Swift ,
269
269
unlike in ObjC, no conservative stack scanning or other hacks are needed. 4)
270
270
If GC is used for mutable data, it would make sense to still use reference
271
271
counting for actors themselves and especially for immutable data, meaning
0 commit comments