How to Kill/Stop a background thread?

后端 未结 1 1470
长发绾君心
长发绾君心 2020-12-11 23:17

So I have a method that performs a loop and because of the way my program works i\'m calling this method using,

[self performSelectorInBackground:@selector(m         


        
相关标签:
1条回答
  • 2020-12-11 23:49

    You shouldn't forcibly kill/stop the thread for reasons outlined in this answer to a similar question, and this answer to another similar question.

    It should be possible to check a boolean as you are doing, and there shouldn't be a problem with another thread setting the value of the boolean. Can you post the code that is attempting to set the boolean?

    0 讨论(0)
提交回复
热议问题