博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
performSelectorInBackground V.S detachNewThreadSelector?
阅读量:6607 次
发布时间:2019-06-24

本文共 908 字,大约阅读时间需要 3 分钟。

Both detachNewThreadSelector and performSelectorInBackground are used to call a method in the background.

Is there any difference between the 2 methods? or do they both work the same way?

 

answer:

They're both essentially the same but slightly different paradigms. Behind the scenes they do exactly the same thing. The only real difference is that -[performSelectorInBackground:withObject:] follows all the other performSelectorstyle methods in that they're defined on NSObject and you actually message that defines the selector you wish to perform.

In general, you should almost never have to call either of these methods. Favor using Grand Central Dispatch or NSOperation and NSOperationQueue to factor out expensive operations on other threads. Both GCD and the NSOperation classes give you memory management, thread pool management and many other things you'll miss using the older style dispatch methods.

转载地址:http://mmiso.baihongyu.com/

你可能感兴趣的文章
2017年敏捷沙滩大会:技术卓越、为持续交付优化的组织、容器安全
查看>>
如何更快乐地工作
查看>>
Nexus指南中的更新强调集成和透明度的重要性
查看>>
书评与摘要:Infrastructure as Code
查看>>
QCon上海2015大会启动筹备,15个专题征集演讲嘉宾
查看>>
移动端点击输入框,enter键问题
查看>>
.NET Core 3.0特性初探:C# 8、WPF、Windows Forms、EF Core
查看>>
重磅!亚马逊将在2019年全面弃用Oracle数据库
查看>>
Azure Service Fabric正式发布
查看>>
GlassFish新纪元
查看>>
io.js 3.0发布:重写Buffer,支持PPC
查看>>
TOP 13大最热开源微服务Java框架
查看>>
日均千亿级别的数据请求量背后的秘密
查看>>
如何用Uber JVM Profiler等可视化工具监控Spark应用程序?
查看>>
shell学习记录
查看>>
Electric Cloud推出用于DevOps的预测分析平台
查看>>
用户吐槽:Azure DevOps CI 体验太差
查看>>
Helm:三思而后用
查看>>
红帽技术开放日:参与开源社区不只有贡献代码这一种方式
查看>>
Firefox Focus:一个iOS的私人浏览器
查看>>