gpt4 book ai didi

cocoa - NSThread 和 detachNewThreadSelector 的区别 :toTarget:withObject:

转载 作者:行者123 更新时间:2023-12-03 17:08:10 24 4
gpt4 key购买 nike

在 NSThread 文档中,我遇到了方法 detachNewThreadSelector:toTarget:withObject:。该方法与使用 initWithTarget:selector:object: 创建线程然后使用 start 启动它有什么区别?

最佳答案

唯一的区别是第二种方式为您提供了对 NSThread 对象的引用,因此您可以在启动之前设置堆栈大小或优先级,或者使用 isExecuting/Finished/Cancelled 方法稍后检查其状态.

关于cocoa - NSThread 和 detachNewThreadSelector 的区别 :toTarget:withObject:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2707773/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com