<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 24 Aug 2016, at 12:38, Chris Bailey via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><font size="2" face="sans-serif" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">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.</font><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote></div><br class=""><div class="">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.</div><div class=""><br class=""></div><div class="">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,</div><div class=""> let s: DispatchSourceRead = […]</div><div class=""> Unmanaged.passRetained(s)</div><div class="">crashes llvm. Giving the typechecker a hint</div><div class=""> Umanaged<DispatchSourceRead>(s)</div><div class="">tells me that type 'DispatchSourceRead' does not conform to protocol ‘AnyObject’ which seems weird. Is it still class-based on Linux, or something different?</div><div class=""><br class=""></div><div class="">I ended up doing this</div><div class=""> var rs: DispatchSourceRead? = rsource</div><div class=""> var ws: DispatchSourceWrite? = wsource<br class=""> rsource.setCancelHandler { _ = rs?.handle; rs = nil } //Access a property to shut the bloody compiler up,<br class=""> wsource.setCancelHandler { _ = ws?.handle; ws = nil } //and to ensure the var isn't optimised away.<br class="">so all the above is moot, but I thought I should report it.</div></body></html>