<html><body><p><tt><br>> From: Drew Crawford via swift-corelibs-dev <swift-corelibs-dev@swift.org></tt><br><tt>> To: swift-corelibs-dev@swift.org</tt><br><tt>> Date: 02/06/2016 08:06 PM</tt><br><tt>> Subject: [swift-corelibs-dev] DISPATCH_QUEUE_CONCURRENT / <br>> DISPATCH_QUEUE_SERIAL</tt><br><tt>> Sent by: swift-corelibs-dev-bounces@swift.org</tt><br><tt>> <br>> I've noticed that, when imported to Swift, the definitions for <br>> DISPATCH_QUEUE_CONCURRENT and DISPATCH_QUEUE_SERIAL aren't correct.</tt><br><tt>> <br>> Specifically, the Linux program I'm porting has build errors of the form</tt><br><tt>> <br>> error: use of unresolved identifier 'DISPATCH_QUEUE_CONCURRENT'</tt><br><tt>> <br>> and</tt><br><tt>> <br>> error: cannot convert value of type '()' to expected argument type <br>> 'dispatch_queue_attr_t' (aka 'COpaquePointer')</tt><br><tt>> private let queue = dispatch_queue_create("foo", DISPATCH_QUEUE_SERIAL)</tt><br><tt>> <br>> ^~~~~~~~~~~~~~~~~~~~~</tt><br><tt>> <br>> "Using the source, luke" suggests that</tt><br><tt>> <br>> DISPATCH_QUEUE_CONCURRENT is defined to a function invocation, which<br>> may not be imported by the Swift importer. I guess this problem is <br>> resolved somehow on Darwin (perhaps by somehow explaining to Swift <br>> to use a constant for this value?) but the mechanism is not clear.</tt><br><tt>> DISPATCH_QUEUE_SERIAL (aka NULL) is apparently imported as a closure<br>> for some reason</tt><br><tt>> <br>> I used Cmd-Opt-J to take a look at where these symbols come from on <br>> Xcode, and it seems that, indeed, they don't come from dispatch.h. <br>> But I'm not sure, in that case, where they come from.</tt><br><tt>> <br>> Maybe somebody can give me a hint how to go about working around / <br>> resolving this?</tt><br><br><tt>Hi Drew,</tt><br><br><tt> Try picking up the changes from this pull request: </tt><a href="https://github.com/apple/swift-corelibs-libdispatch/pull/43"><tt>https://github.com/apple/swift-corelibs-libdispatch/pull/43</tt></a><br><br><tt> It adapts the Swift wrapper used on Darwin for Linux and builds it into libdispatch.</tt><br><br><tt> Since libdisaptch is not built with objective C support on Linux, there is additional work beyond this pull request that still needs to be done (the Swift importer also appears to not understand the dispatch_object_t union type). But this pull request should allow DISPATCH_QUEUE_SERIAL and DISPATCH_QUEUE_CONCURRENT to work.</tt><br><br><tt>--dave</tt><br><BR>
</body></html>