@@ -216,9 +216,10 @@ including important milestones.
216
216
217
217
Because Swift concurrency can resume on a different thread
218
218
after a potential suspension point,
219
- you can't use elements like thread-local storage, locks, mutexes, and semaphores
220
- across suspension points. For example, accessing thread-local storage
221
- on both sides of a suspension point could produce unintended behaviors.
219
+ you can't use elements like thread-local storage, locks, mutexes, or semaphores
220
+ across suspension points.
221
+ For example, accessing thread-local storage
222
+ on both sides of a suspension point could produce incorrect results.
222
223
223
224
``` swift
224
225
let customThreadLog = " CustomThreadLog"
@@ -275,12 +276,12 @@ including important milestones.
275
276
}
276
277
```
277
278
278
- While the ` noasync ` argument prevents accidental, unsafe use of a symbol,
279
+ While declaring noasync availability prevents accidental, unsafe use of a symbol,
279
280
it can also prevent safe uses.
280
- In many cases, ` nonasync ` symbols can still be used safely in specific situations.
281
+ In some cases, the symbols can be used safely in specific situations.
281
282
If you can ensure that a particular use is safe in an asynchronous context,
282
283
wrap the symbol in a safe, synchronous function.
283
- You can then call that synchronous wrapper from your asynchronous context .
284
+ You can then call the synchronous wrapper from your asynchronous code .
284
285
The compiler won't raise an error, because the ` noasync ` symbol
285
286
isn't used directly in an asynchronous context.
286
287
@@ -296,15 +297,17 @@ including important milestones.
296
297
297
298
appendToLog (" \( name ) \( result ? " is" : " isn't" ) verified!\n\n " )
298
299
299
- // Multiple calls to safeVerify() may not occur on the same thread.
300
+ // If this is called from an asynchronous context,
301
+ // multiple calls to safeVerify() don't necessarily occur on the same thread,
302
+ // and each thread has its own log.
300
303
// Return the log for the current thread.
301
304
return readLog () ?? " No log found."
302
305
}
303
306
```
304
307
305
- You can use the ` noasync ` argument with most declarations;
306
- however, you can't use it when declaring destructors,
307
- because the system must be able to call destructors from any context.
308
+ You can use noasync availability with most declarations;
309
+ however, you can't use it when declaring destructors.
310
+ The system must be able to call destructors from any context.
308
311
309
312
- The ` message ` argument provides a textual message that the compiler displays
310
313
when emitting a warning or error about the use of a deprecated, obsoleted,
0 commit comments