cfrunloop

CFRunLoopRun() vs [NSRunLoop run]

那年仲夏 提交于 2019-11-29 01:27:41
I have an NSRunLoop object, to which I attach timers and streams. It works great. Stopping it is another story alltogether. I run the loop using [runLoop run] . If I try to stop the loop using CRunLoopStop([[NSRunLoop currentRunLoop] getCFRunLoop]) , the loop won't stop. If I start the loop using CRunLoopRun() instead, it works. I have also made sure that the call is made on the correct thread (the one running my custom run loop). I have debugged this with pthread_self() . I found a mailing list archive, where a developer said "don't bother using CRunLoopStop() if you started the loop using

CFRunLoop in Swift Command Line Program

邮差的信 提交于 2019-11-26 14:43:34
I am writing a command line application in Swift using a third-party framework that (if I understand the code correctly) relies on GCD callbacks to complete certain actions when a socket receives data. In order to better understand the framework, I have been playing around with a sample Cocoa application the framework's author wrote to go along with the framework. Because the sample application is a Cocoa application, the run loops are handled automatically. I'm including snippets of code from the sample application (MIT license) to give an idea of how it works: class AppDelegate: NSObject,

CFRunLoop in Swift Command Line Program

拈花ヽ惹草 提交于 2019-11-26 03:59:44
问题 I am writing a command line application in Swift using a third-party framework that (if I understand the code correctly) relies on GCD callbacks to complete certain actions when a socket receives data. In order to better understand the framework, I have been playing around with a sample Cocoa application the framework\'s author wrote to go along with the framework. Because the sample application is a Cocoa application, the run loops are handled automatically. I\'m including snippets of code