[swift-users] Illegal Instruction: 4 OS X libdispatch

Tyler Cloutier cloutiertyler at aol.com
Tue May 3 14:21:25 CDT 2016


> On May 3, 2016, at 10:11 AM, Quinn The Eskimo! via swift-users <swift-users at swift.org> wrote:
> 
> 
> On 3 May 2016, at 18:02, Tyler Fleming Cloutier <cloutiertyler at aol.com> wrote:
> 
>> My motivation for doing something like that is that I would prefer not to make the listen function mutating inside my struct.
> 
> I recommend that you be explicit about your source references.  If this struct owns the source, have it maintain a strong reference to the source.  In your case it seems that `fd` is an attribute of the struct, so you could create the source when the struct is initialised with `fd`.  You don’t have to configure or resume it at that point, just create it.
> 
> Share and Enjoy

Yep that would work, however, it’s a little trickier if I want to have a protocol extension:

https://github.com/TheArtOfEngineering/Edge/blob/master/Sources/IOStream.swift <https://github.com/TheArtOfEngineering/Edge/blob/master/Sources/IOStream.swift>

I could just have a readonly var which just references the underlying dispatch_source_t though!

Thanks for the help!


> --
> Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
> 
> 
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160503/1c810fe2/attachment.html>


More information about the swift-users mailing list