0

I am starting a thread using detachNewThreadSelector. i dont want to start thread everytime. i need to check that thread is already running, if that thread is already running then don't start the thread, if not then only start the thread. can anyone help me how to check the thread state?

4

2 回答 2

0

您可以使用检查线程的运行状态 isExecuting

BOOL isStillRunning = [yourThreadObject isExecuting];
于 2013-08-19T08:31:27.680 回答
-1

启动线程,不要让它终止。然后,您可以合理地假设线程存在(这是您真正想要的?),而无需实际检查它。

于 2013-08-19T09:46:08.107 回答