@@ -200,27 +200,32 @@ while this code waits for the picture to be ready.
200200To understand the concurrent nature of the example above,
201201here's one possible order of execution:
202202
203- - The code starts running from the first line
203+ 1 . The code starts running from the first line
204204 and runs up to the first ` await ` .
205205 It calls the ` listPhotos(inGallery:) ` function
206206 and suspends execution while it waits for that function to return.
207- - While this code's execution is suspended,
207+
208+ 2 . While this code's execution is suspended,
208209 some other concurrent code in the same program runs.
209210 For example, maybe a long-running background task
210211 continues updating a list of new photo galleries.
211212 That code also runs until the next suspension point, marked by ` await ` ,
212213 or until it completes.
213- - After ` listPhotos(inGallery:) ` returns,
214+
215+ 3 . After ` listPhotos(inGallery:) ` returns,
214216 this code continues execution starting at that point.
215217 It assigns the value that was returned to ` photoNames ` .
216- - The lines that define ` sortedNames ` and ` name `
218+
219+ 4 . The lines that define ` sortedNames ` and ` name `
217220 are regular, synchronous code.
218221 Because nothing is marked ` await ` on these lines,
219222 there aren't any possible suspension points.
220- - The next ` await ` marks the call to the ` downloadPhoto(named:) ` function.
223+
224+ 5 . The next ` await ` marks the call to the ` downloadPhoto(named:) ` function.
221225 This code pauses execution again until that function returns,
222226 giving other concurrent code an opportunity to run.
223- - After ` downloadPhoto(named:) ` returns,
227+
228+ 6 . After ` downloadPhoto(named:) ` returns,
224229 its return value is assigned to ` photo `
225230 and then passed as an argument when calling ` show(_:) ` .
226231
@@ -235,8 +240,10 @@ Because code with `await` needs to be able to suspend execution,
235240only certain places in your program can call asynchronous functions or methods:
236241
237242- Code in the body of an asynchronous function, method, or property.
243+
238244- Code in the static ` main() ` method of
239245 a structure, class, or enumeration that's marked with ` @main ` .
246+
240247- Code in an unstructured child task,
241248 as shown in < doc:Concurrency#Unstructured-Concurrency > below.
242249
0 commit comments