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?
Is there a way to determine on which thread a specified piece of code is being run?
All method calls take place in the current thread, unless you do something like
performSelectorInBackground:
You can probably tell if you're running in the main thread by comparing
[NSRunLoop currentRunLoop]
to[NSRunLoop mainRunLoop]
See also: Threading Programming Guide
精彩评论