@@ -219,25 +219,25 @@ including important milestones.
219
219
using elements like thread-local storage, locks, mutexes, or semaphores
220
220
across suspension points can lead to incorrect results.
221
221
222
- To avoid any errors , add an ` @available(*, noasync) ` attribute to the symbol's declaration:
222
+ To avoid this problem , add an ` @available(*, noasync) ` attribute to the symbol's declaration:
223
223
224
224
``` swift
225
225
extension pthread_mutex_t {
226
-
226
+
227
227
@available (* , noasync )
228
228
mutating func lock () {
229
229
pthread_mutex_lock (& self )
230
230
}
231
-
231
+
232
232
@available (* , noasync )
233
233
mutating func unlock () {
234
234
pthread_mutex_unlock (& self )
235
235
}
236
236
}
237
237
```
238
-
239
- This attribute tells the compiler to raise a build error
240
- when someone uses the symbol in an asynchronous context.
238
+
239
+ This attribute raises a compile-time error
240
+ when someone uses the symbol in an asynchronous context.
241
241
You can also use the ` message ` argument to provide additional information
242
242
about the symbol.
243
243
@@ -248,17 +248,17 @@ including important milestones.
248
248
}
249
249
```
250
250
251
- If you can guarantee that your code uses a potentially unsafe symbol in a safe manner,
252
- you can wrap it in a synchronous function and call that function
251
+ If you can guarantee that your code uses a potentially unsafe symbol in a safe manner,
252
+ you can wrap it in a synchronous function and call that function
253
253
from an asynchronous context.
254
254
255
255
``` swift
256
256
257
257
// Provide a synchronous wrapper around methods with a noasync declaration.
258
258
extension pthread_mutex_t {
259
- mutating func withLock (_ op : () -> ()) {
259
+ mutating func withLock (_ operation : () -> ()) {
260
260
self .lock ()
261
- op ()
261
+ operation ()
262
262
self .unlock ()
263
263
}
264
264
}
@@ -273,13 +273,13 @@ including important milestones.
273
273
}
274
274
```
275
275
276
- You can use noasync availability with most declarations;
276
+ You can use noasync availability with most declarations;
277
277
however, you can't use it when declaring deinitializers.
278
- Swift must be able to call a class's deinitializers from any context,
278
+ Swift must be able to call a class's deinitializers from any context,
279
279
both synchronous and asynchronous.
280
280
281
281
- The ` message ` argument provides a textual message that the compiler displays
282
- when emitting a warning or error about the use of a deprecated, obsoleted,
282
+ when emitting a warning or error about the use of a deprecated, obsoleted,
283
283
or noasync declaration.
284
284
It has the following form:
285
285
0 commit comments