[swift-corelibs-dev] DISPATCH_QUEUE_CONCURRENT /DISPATCH_QUEUE_SERIAL

David P Grove groved at us.ibm.com
Sat Feb 6 19:34:17 CST 2016



> From: Drew Crawford via swift-corelibs-dev <swift-corelibs-dev at swift.org>
> To: swift-corelibs-dev at swift.org
> Date: 02/06/2016 08:06 PM
> Subject: [swift-corelibs-dev] DISPATCH_QUEUE_CONCURRENT /
> DISPATCH_QUEUE_SERIAL
> Sent by: swift-corelibs-dev-bounces at swift.org
>
> 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" suggests that
>
> DISPATCH_QUEUE_CONCURRENT is defined to a function invocation, 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?

Hi Drew,

	Try picking up the changes from this pull request:
https://github.com/apple/swift-corelibs-libdispatch/pull/43

	It adapts the Swift wrapper used on Darwin for Linux and builds it
into libdispatch.

	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.

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


More information about the swift-corelibs-dev mailing list