开发者

Can you have more than one runloop per thread on iOS?

Are there any possible way to create two or more run loop in one thread? Or one thread can have only one run loop?

My partner tells me, one thread is possible to have two or more run loop inside. And I doubt it. I had google开发者_如何学编程d but found nothing. So, is it possible to have two or more run loop in one thread ?


From Apple's documentation on NSRunLoop:

Your application cannot either create or explicitly manage NSRunLoop objects. Each NSThread object, including the application’s main thread, has an NSRunLoop object automatically created for it as needed.

Beyond that, I see no reason why you'd want to create more than one runloop per thread.


I would like to add this quote from CFRunLoop Reference documentation

There is exactly one run loop per thread. You neither create nor destroy a thread’s run loop. Core Foundation automatically creates it for you as needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜