RunLoop-Custom input source

时间:2023-03-10 05:13:21
RunLoop-Custom input source

Creating

Creating a custom input source involves defining the following:

  • The information you want your input source to process.
  • A scheduler routine to let interested clients know how to contact your input source.

Signaling the Input Source

  • After it hands off its data to the input source, a client must signal the source and wake up its run loop.
  • Signaling the source lets the run loop know that the source is ready to be processed
  • you should always wake up the run loop explicitly

    tips

  • when the allotted time expires,the run loop call CFRunLoopSourceInvalidate to invalidate all the source0(at the same time invoke cancellation routine to inform the client)

  • CFRunLoopSourceInvalidate removes source from all the run loop modes in which it was registered.