File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -1116,14 +1116,25 @@ overriding an implicit conformance to the `Sendable` protocol,
11161116use an extension:
11171117
11181118``` swift
1119- struct NonsendableTemperatureReading {
1120- var measurement: Int
1119+ struct FileDescriptor {
1120+ let rawValue: CInt
11211121}
11221122
11231123@available (* , unavailable )
1124- extension NonsendableTemperatureReading : Sendable { }
1124+ extension FileDescriptor : Sendable { }
11251125```
11261126
1127+ <!--
1128+ The example above is abbreviated from a Swift System API.
1129+ https://github.com/apple/swift-system/blob/main/Sources/System/FileDescriptor.swift
1130+ -->
1131+
1132+ The code above shows part of a wrapper around POSIX file descriptors.
1133+ Even though interface for file descriptors uses integers
1134+ to identify and interact with open files,
1135+ and integer values are sendable,
1136+ a file descriptor isn't safe to send across concurrency domains.
1137+
11271138<!--
11281139 - test: `suppressing-implied-sendable-conformance`
11291140
You can’t perform that action at this time.
0 commit comments