Based on NSRunLoop means that the callback function will run on the main thread through this mechanism during callback, ensuring that there will be no cross-thread calling problems. But its bottom layer is still implemented using threads, so many threads will be created.
If you are scanning ports and opening so many threads will not cause the system to freeze or anything, just use it as it is. There is probably no optimization worth doing.
Based on
NSRunLoop
means that the callback function will run on the main thread through this mechanism during callback, ensuring that there will be no cross-thread calling problems. But its bottom layer is still implemented using threads, so many threads will be created.If you are scanning ports and opening so many threads will not cause the system to freeze or anything, just use it as it is. There is probably no optimization worth doing.