[swift-corelibs-dev] DISPATCH_QUEUE_CONCURRENT / DISPATCH_QUEUE_SERIAL

Drew Crawford drew at sealedabstract.com
Sat Feb 6 19:06:38 CST 2016


I've noticed that, when imported to Swift, the definitions for DISPATCH_QUEUE_CONCURRENT and DISPATCH_QUEUE_SERIAL aren't correct.

Specifically, the Linux program I'm porting has build errors of the form

error: use of unresolved identifier 'DISPATCH_QUEUE_CONCURRENT'

and

error: cannot convert value of type '()' to expected argument type 'dispatch_queue_attr_t' (aka 'COpaquePointer')
private let queue = dispatch_queue_create("foo", DISPATCH_QUEUE_SERIAL)
                                                                                ^~~~~~~~~~~~~~~~~~~~~

"Using the source, luke <https://github.com/apple/swift-corelibs-libdispatch/blob/acd56f625cce04d280fa83712e0add9c34506073/dispatch/queue.h#L437>" suggests that

DISPATCH_QUEUE_CONCURRENT is defined to a function invocation <https://github.com/apple/swift-corelibs-libdispatch/blob/acd56f625cce04d280fa83712e0add9c34506073/dispatch/queue.h#L437>, which may not be imported by the Swift importer.  I guess this problem is resolved somehow on Darwin (perhaps by somehow explaining to Swift to use a constant for this value?) but the mechanism is not clear.
DISPATCH_QUEUE_SERIAL (aka NULL) is apparently imported as a closure for some reason

I used Cmd-Opt-J to take a look at where these symbols come from on Xcode, and it seems that, indeed, they don't come from dispatch.h.  But I'm not sure, in that case, where they come from.

Maybe somebody can give me a hint how to go about working around / resolving this?

Drew



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20160206/cc70e750/attachment.html>


More information about the swift-corelibs-dev mailing list