DispatchSourceProtocol, DispatchSourceRead,
DispatchSourceSignal, DispatchSourceTimer,
DispatchSourceUserDataAdd, DispatchSourceUserDataOr,
- DispatchSourceWrite {
+ DispatchSourceUserDataReplace, DispatchSourceWrite {
internal let __wrapped:dispatch_source_t
final internal override func wrapped() -> dispatch_object_t {
}
#endif
-#if !os(Linux)
+#if !os(Linux) && !os(Android)
extension DispatchSource : DispatchSourceProcess,
DispatchSourceFileSystemObject {
}
internal class __DispatchData : DispatchObject {
internal let __wrapped:dispatch_data_t
- internal let __owned:Bool
final internal override func wrapped() -> dispatch_object_t {
return unsafeBitCast(__wrapped, to: dispatch_object_t.self)
internal init(data:dispatch_data_t, owned:Bool) {
__wrapped = data
- __owned = owned
+ if !owned {
+ _swift_dispatch_retain(unsafeBitCast(data, to: dispatch_object_t.self))
+ }
}
deinit {
- if __owned {
- _swift_dispatch_release(wrapped())
- }
+ _swift_dispatch_release(wrapped())
}
}
func or(data: UInt)
}
+public protocol DispatchSourceUserDataReplace : DispatchSourceProtocol {
+ func replace(data: UInt)
+}
+
#if HAVE_MACH
public protocol DispatchSourceMachSend : DispatchSourceProtocol {
public var handle: mach_port_t { get }
}
#endif
-#if !os(Linux)
+#if !os(Linux) && !os(Android)
public protocol DispatchSourceProcess : DispatchSourceProtocol {
var handle: pid_t { get }
func scheduleRepeating(wallDeadline: DispatchWallTime, interval: Double, leeway: DispatchTimeInterval)
}
-#if !os(Linux)
+#if !os(Linux) && !os(Android)
public protocol DispatchSourceFileSystemObject : DispatchSourceProtocol {
var handle: Int32 { get }
@_silgen_name("_swift_dispatch_release")
internal func _swift_dispatch_release(_ obj: dispatch_object_t) -> Void
+
+@_silgen_name("_swift_dispatch_retain")
+internal func _swift_dispatch_retain(_ obj: dispatch_object_t) -> Void