Worker Thread iOS

前端 未结 4 926
野性不改
野性不改 2021-01-03 10:20

I want to create a background thread on the iPhone that executes some code every 10msec. But before I get lost in the concurrency programming guide and the threading program

4条回答
  •  猫巷女王i
    2021-01-03 10:43

    NSRunLoop is the missing link.

    You will have to setup the thread's run loop to repeat, or you can control this from your thread's entry. the thread hosts the timer (the timer will die with the run loop if it's still alive).

    NSRunLoop is a pretty small class - check it and the related samples out.

提交回复
热议问题