int main(int argc, char * argv[]) {
NSString * appDelegateClassName;
@autoreleasepool {
// Setup code that might create autoreleased objects goes here.
appDelegateClassName = NSStringFromClass([AppDelegate class]);
}
return UIApplicationMain(argc, argv, nil, appDelegateClassName);
}
int main(int argc, char * argv[]) {
NSString * appDelegateClassName;
@autoreleasepool {
// Setup code that might create autoreleased objects goes here.
appDelegateClassName = NSStringFromClass([AppDelegate class]);
}
int res = 0;
do {
int message = sleep();
res = doSomething(message);
} while (res== 0);
return UIApplicationMain(argc, argv, nil, appDelegateClassName);
}
NSRunLoop *runloop = [NSRunLoop currentRunLoop];
CFRunLoopRef runloop2 = CFRunLoopGetCurrent();
可以看到,CFRunLoopRef的地址和NSRunLoop的_rl的地址指向是一样的
dispatch_async(<#dispatch_queue_t _Nonnull queue#>, ^{
// 子线程默认没有Runloop,除非手动调用
[NSRunLoop currentRunLoop];
});
NSRunLoop *runloop = [NSRunLoop currentRunLoop];
NSRunLoop *runloop1 = [NSRunLoop mainRunLoop];
CFRunLoopRef runloop2 = CFRunLoopGetCurrent();
CFRunLoopRef runloop3 = CFRunLoopGetMain();
原文地址:https://blog.csdn.net/JH_Cao/article/details/122573345
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.7code.cn/show_39472.html
如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱:suwngjj01@126.com进行投诉反馈,一经查实,立即删除!