4 Replies
      Latest reply on Nov 8, 2018 1:23 AM by eskimo
      simpleone Level 1 Level 1 (0 points)

        Short one:

         

        on macOS - is DispatchSource built on top of kevent? I suspect yes, but I can not find a direct mention.

         

        thx!

        • Re: DispatchSource (a.k.a. dispatch_source_t) vs kevent
          Ken Thomases Level 4 Level 4 (745 points)

          As an implementation detail, yes, it does.  To verify, consider the output of this command:

           

          nm -m /usr/lib/system/libdispatch.dylib | egrep -e '(\b|_)kqueue' -e '(\b|_)kevent'
          • Re: DispatchSource (a.k.a. dispatch_source_t) vs kevent
            eskimo Apple Staff Apple Staff (11,495 points)

            is DispatchSource built on top of kevent?

            Just out of curiosity, why does this matter to you?

            Share and Enjoy

            Quinn “The Eskimo!”
            Apple Developer Relations, Developer Technical Support, Core OS/Hardware
            let myEmail = "eskimo" + "1" + "@apple.com"

              • Re: DispatchSource (a.k.a. dispatch_source_t) vs kevent
                simpleone Level 1 Level 1 (0 points)

                a) just curious as you

                b) if you search apple docs how to handle file system changes - it directs you to kevents not to GCD (legacy stuff)

                c) documentation on DispatchSource does not explain event semantics too well, while `man kevent` does. wanted to know they are semantically equal.

                  • Re: DispatchSource (a.k.a. dispatch_source_t) vs kevent
                    eskimo Apple Staff Apple Staff (11,495 points)

                    b) if you search apple docs how to handle file system changes - it directs you to kevents not to GCD (legacy stuff)

                    Quite.  That’s just because kevents were introduced before Dispatch.

                    I’d appreciate you filing bugs against docs like this.  There are some good reasons to use kevents, like compatibility with other platforms, but the bulk of our developers should use dispatch sources for this sort of thing.  Using kevents correctly is really hard.

                    c) documentation on DispatchSource does not explain event semantics too well, while man kevent does. wanted to know they are semantically equal.

                    Again, if you find the Dispatch documentation inadequate that’s totally bugworthy.

                    Share and Enjoy

                    Quinn “The Eskimo!”
                    Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                    let myEmail = "eskimo" + "1" + "@apple.com"