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

Quinn "The Eskimo!" eskimo1 at apple.com
Mon May 2 03:16:26 CDT 2016


On 1 May 2016, at 19:33, Tyler Fleming Cloutier via swift-users <swift-users at swift.org> wrote:

> I’m creating a Swift package that uses Dispatch on OS X, but I am getting an Illegal Instruction error after I register my block for an event. Specifically, a UD2 instruction inside of libdispatch:

Intel code uses the `ud2` illegal instruction for `__builtin_trap`, that is, as a way for the code to stop when some sort of error has been detected.

In your case I believe that you’re using your dispatch source incorrectly.  Specifically:

* You should hold on to a reference to `dispatchSource`.

* You need to `dispatch_resume` the source before it’ll do anything.

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware




More information about the swift-users mailing list