Does iPhone OS distinguish between foreground and background threads?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is the notion of the main thread, where all UIKit and Core Graphics calls have to come from. I suppose you could say the main thread is a foreground thread and all other threads in your app are background threads.
You can start a background thread with
performSelectorInBackground:withObject:onNSObject. If you need to do some work on the main thread (eg. do some UI stuff), you can useperformSelectorOnMainThread:withObject:waitUntilDone:. If you need to check if your code is currently running on the main thread, you can use[NSThread isMainThread].