Linux equivalent of macOS/iOS run loop, aka libdispatch/Dispatch on Linux

I've got Swift and libdispatch installed and linking under Ubuntu 16.04, but I'm not sure how to set up the Linux equivalent of the macOS run loop in order to service all the dispatch queues.

I'm having a hard time finding an example of how to do this. Some GCD C code calls dispatch_main() from the main thread after initial program setup. I couldn't find an equivalent in the Dispatch package, when looking through the sources.

Can anyone tell me how to do this, or point me at an example?

Thanks!

···

--
Rick Mann
rmann@latencyzero.com

Dispatch equivalent should be dispatchMain(), unless that’s not available on Linux for some reason.

Jon

···

On Apr 5, 2017, at 4:28 PM, Rick Mann via swift-users <swift-users@swift.org> wrote:

I've got Swift and libdispatch installed and linking under Ubuntu 16.04, but I'm not sure how to set up the Linux equivalent of the macOS run loop in order to service all the dispatch queues.

I'm having a hard time finding an example of how to do this. Some GCD C code calls dispatch_main() from the main thread after initial program setup. I couldn't find an equivalent in the Dispatch package, when looking through the sources.

Can anyone tell me how to do this, or point me at an example?

Thanks!

--
Rick Mann
rmann@latencyzero.com

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

1 Like

Dispatch equivalent should be dispatchMain(), unless that’s not available on Linux for some reason.

As seems to always be the case, as soon as I post to the list, I find that answer. I swear I searched for 30 minutes before finding it.

I finally found a Swift example that used dispatch_main(), and the Swift compiler helpfully told me to try dispatchMain().

Thank you for confirming!

···

On Apr 5, 2017, at 13:32 , Jon Shier <jon@jonshier.com> wrote:

Jon

On Apr 5, 2017, at 4:28 PM, Rick Mann via swift-users <swift-users@swift.org> wrote:

I've got Swift and libdispatch installed and linking under Ubuntu 16.04, but I'm not sure how to set up the Linux equivalent of the macOS run loop in order to service all the dispatch queues.

I'm having a hard time finding an example of how to do this. Some GCD C code calls dispatch_main() from the main thread after initial program setup. I couldn't find an equivalent in the Dispatch package, when looking through the sources.

Can anyone tell me how to do this, or point me at an example?

Thanks!

--
Rick Mann
rmann@latencyzero.com

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

--
Rick Mann
rmann@latencyzero.com