> On 24 Aug 2016, at 12:38, Chris Bailey via swift-users
> <swift-users@swift.org> wrote:
>
> If you haven't spotted it, the new snapshots include Dispatch on Linux for
> the first time - please test it out as there may well be number of issues to
> shake out, especially with the new Swift 3 API.
A couple more DispatchSource issues - I’m getting a crash (on all platforms) if
a source deallocs before the cancellation handler has been called, which seems
to be a known issue.
To get around it on Darwin, I was taking an unmanaged retained ref to the
source and releasing it in the cancellation handler. But it turns out that on
Linux,
let s: DispatchSourceRead = […]
Unmanaged.passRetained(s)
crashes llvm. Giving the typechecker a hint
Umanaged<DispatchSourceRead>(s)
tells me that type 'DispatchSourceRead' does not conform to protocol
‘AnyObject’ which seems weird. Is it still class-based on Linux, or something
different?
I ended up doing this
var rs: DispatchSourceRead? = rsource
var ws: DispatchSourceWrite? = wsource
rsource.setCancelHandler { _ = rs?.handle; rs = nil } //Access a property
to shut the bloody compiler up,
wsource.setCancelHandler { _ = ws?.handle; ws = nil } //and to ensure the
var isn't optimised away.
so all the above is moot, but I thought I should report it.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users