Skip to content

Initialise dispatch_queue_attr_concurrent on Linux #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2016

Conversation

seabaylea
Copy link
Contributor

Three of the tests are failing because the DISPATCH_QUEUE_CONCURRENT structure hasn't been initialised (the value for DISPATCH_QUEUE_CONCURRENT->do_vtable is NULL.

This is occurring because DISPATCH_QUEUE_CONCURRENT is aliased to _dispatch_queue_attrs in xcodeconf/libdispatch.aliases, but aliasing (the use of the -alias_list linker option) is only supported on Darwin.

Up until libdispatch-4xx, DISPATCH_QUEUE_CONCURRENT was initialised explicitly in init.c. Taking that approach for non-Apple platforms certainly solves the issue, but there may be a better approach to doing the equivalent of aliasing on Linux.

@MadCoder
Copy link
Contributor

MadCoder commented Jan 6, 2016

ELF supports aliases from gcc/clang.

you should use:

#ifndef __APPLE__
struct dispatch_queue_attr_s _dispatch_queue_attr_concurrent
        __attribute__((__alias__("_dispatch_queue_attrs")));
#endif

that should work just fine.

@MadCoder
Copy link
Contributor

MadCoder commented Jan 6, 2016

you may need extern on top, like this:

#ifndef __APPLE__
extern struct dispatch_queue_attr_s _dispatch_queue_attr_concurrent
        __attribute__((__alias__("_dispatch_queue_attrs")));
#endif

I'll let you play with it until you find the right combination that works, glibc does this everywhere in its source

@seabaylea
Copy link
Contributor Author

Thanks - I'll do some experimenting and then update the PR.

@MadCoder
Copy link
Contributor

MadCoder commented Jan 6, 2016

I'll ask you to submit a new one so that we get a single patch once you get the right one though, but let leaev that one open until you submit the new one so that nobody tries to fix that concurrently ;)

@seabaylea
Copy link
Contributor Author

I can just squash the commits under this PR if that helps?

@MadCoder
Copy link
Contributor

MadCoder commented Jan 6, 2016

I don't think github lets you do that :) but if it allows for it, sure go ahead!

@seabaylea
Copy link
Contributor Author

Looks like your suggestion was all that was needed. I've built/tested and updated the commit in the PR (by squashing the commits and doing a force push to the branch).

MadCoder added a commit that referenced this pull request Jan 6, 2016
Initialise dispatch_queue_attr_concurrent on Linux
@MadCoder MadCoder merged commit 50faff5 into swiftlang:master Jan 6, 2016
das pushed a commit that referenced this pull request Jun 14, 2016
Initialise dispatch_queue_attr_concurrent on Linux

Signed-off-by: Daniel A. Steffen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants