The kqueue API is similar to select, and has the same limitations with respect to blocking threads.
Using libdispatch is a better option for GUI applications. The file descriptors can be monitored on a background thread and processed on the main thread.
Using NSFileHandle is an even simpler option for GUI applications. The only caveat is that the readability handler is called on a random thread. If you need to update your UI in response to something read from the file descriptor, you will need to move over to the main thread.
No comments:
Post a Comment