Skip to content

Commit 6886c41

Browse files
committed
Incorporating Alex's feedback.
1 parent bbad415 commit 6886c41

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

TSPL.docc/ReferenceManual/Attributes.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -219,25 +219,25 @@ including important milestones.
219219
using elements like thread-local storage, locks, mutexes, or semaphores
220220
across suspension points can lead to incorrect results.
221221

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:
223223

224224
```swift
225225
extension pthread_mutex_t {
226-
226+
227227
@available(*, noasync)
228228
mutating func lock() {
229229
pthread_mutex_lock(&self)
230230
}
231-
231+
232232
@available(*, noasync)
233233
mutating func unlock() {
234234
pthread_mutex_unlock(&self)
235235
}
236236
}
237237
```
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.
241241
You can also use the `message` argument to provide additional information
242242
about the symbol.
243243

@@ -248,17 +248,17 @@ including important milestones.
248248
}
249249
```
250250

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
253253
from an asynchronous context.
254254

255255
```swift
256256

257257
// Provide a synchronous wrapper around methods with a noasync declaration.
258258
extension pthread_mutex_t {
259-
mutating func withLock(_ op: () -> ()) {
259+
mutating func withLock(_ operation: () -> ()) {
260260
self.lock()
261-
op()
261+
operation()
262262
self.unlock()
263263
}
264264
}
@@ -273,13 +273,13 @@ including important milestones.
273273
}
274274
```
275275

276-
You can use noasync availability with most declarations;
276+
You can use noasync availability with most declarations;
277277
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,
279279
both synchronous and asynchronous.
280280

281281
- 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,
283283
or noasync declaration.
284284
It has the following form:
285285

0 commit comments

Comments
 (0)