开发者

Threading questions

开发者 https://www.devze.com 2022-12-26 20:41 出处:网络
If I spawn a secondary thread and the threaded method calls other methods, are those methods r开发者_如何学JAVAun in the secondary thread or the main thread?
  1. If I spawn a secondary thread and the threaded method calls other methods, are those methods r开发者_如何学JAVAun in the secondary thread or the main thread?

  2. Is there a way to determine on which thread a specified piece of code is being run?


  1. All method calls take place in the current thread, unless you do something like performSelectorInBackground:

  2. You can probably tell if you're running in the main thread by comparing [NSRunLoop currentRunLoop] to [NSRunLoop mainRunLoop]

See also: Threading Programming Guide

0

精彩评论

暂无评论...
验证码 换一张
取 消