Skip to content

Commit ff7fb3e

Browse files
committed
proper OS-dependent declaration of protocol conformance for DispatchSource
1 parent a32d551 commit ff7fb3e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/swift/Wrapper.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ public class DispatchQueue : DispatchObject {
139139
}
140140
}
141141

142-
// FIXME: the list of implemented protocols is OS dependent.
143-
// need to properly conditionalize this declaration.
144142
public class DispatchSource : DispatchObject,
145143
DispatchSourceType, DispatchSourceRead,
146144
DispatchSourceSignal, DispatchSourceTimer,
@@ -157,6 +155,18 @@ public class DispatchSource : DispatchObject,
157155
}
158156
}
159157

158+
#if HAVE_MACH
159+
extension DispatchSource : DispatchSourceMachSend,
160+
DispatchSourceMachReceive, DispatchSourceMemoryPressure {
161+
}
162+
#endif
163+
164+
#if !os(Linux)
165+
extension DispatchSource : DispatchSourceProcess,
166+
DispatchSourceFileSystemObject {
167+
}
168+
#endif
169+
160170
public protocol DispatchSourceType {
161171
#if false // crashes the swift compiler
162172
typealias DispatchSourceHandler = @convention(block) () -> Void

0 commit comments

Comments
 (0)