Skip to content

Linux port of libdispatch-685 merge #81

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
Jun 15, 2016

Conversation

dgrove-oss
Copy link
Contributor

Minimal set of changes to get sources merged
from libdispatch-685 to compile and run on Linux.

@@ -295,9 +295,6 @@ AC_MSG_CHECKING([what semaphore type to use]);
AS_IF([test "x$have_mach" = "xtrue"],
[AC_DEFINE(USE_MACH_SEM, 1, [Define to use Mach semaphores])
AC_MSG_RESULT([Mach semaphores])],
[test "x$have_futex" = "xtrue"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is very good, you should also get rid of all the code guarded with #if USE_FUTEX_SEM that is still around

@dgrove-oss
Copy link
Contributor Author

revised based on feedback; squashed & force-pushed.

// FIXME: Need real implementation of this + related functions for Linux
DISPATCH_NOINLINE
void
_dispatch_queue_class_override_drainer(dispatch_queue_t dq,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's not the right patch please remove that hunk, and instead do this:

 DISPATCH_NOINLINE
 void
 _dispatch_queue_wakeup(dispatch_queue_t dq, pthread_priority_t pp,
        dispatch_wakeup_flags_t flags)
 {
    dispatch_queue_wakeup_target_t target = DISPATCH_QUEUE_WAKEUP_NONE;

    if (_dispatch_queue_class_probe(dq)) {
        target = DISPATCH_QUEUE_WAKEUP_TARGET;
    }
    if (target) {
        return _dispatch_queue_class_wakeup(dq, pp, flags, target);
+#if HAVE_PTHREAD_WORKQUEUE_QOS
    } else if (pp) {
        return _dispatch_queue_class_override_drainer(dq, pp, flags);
+#endif
    } else if (flags & DISPATCH_WAKEUP_CONSUME) {
        return _dispatch_release_tailcall(dq);
    }
 }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason is that _dispatch_queue_class_override_drainer() only makes sense if you have QoS support which linux doesn't so there's no point having the code in the first place, as you can see _dispatch_queue_class_override_drainer() is not reachable because it is itself under #if HAVE_PTHREAD_WORKQUEUE_QOS

Minimal set of changes to get sources merged
from libdispatch-685 to compile and run on Linux.
@dgrove-oss
Copy link
Contributor Author

Thanks. updated. Also had to guard calls to _dispatch_queue_class_override_drainer in source.c

@MadCoder
Copy link
Contributor

Makes perfect sense.

@MadCoder MadCoder merged commit 5ea30b5 into swiftlang:master Jun 15, 2016
das pushed a commit that referenced this pull request Aug 11, 2016
Linux port of libdispatch-685 merge

Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
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.

2 participants