IOS Interview Runloop

Source: Internet
Author: User

Transferred from: HTTP://WWW.JIANSHU.COM/P/41901FB416D6

What is Runloop?
From a literal point of view: Running loops, running laps
In fact, it is the Do-while loop, which constantly handles various tasks within the loop (such as source, Timer, Observer)
One thread corresponds to a runloop, the runloop of the main thread is started by default, the runloop of the child thread must be started manually (call the Run method)
Runloop can only select one mode to start, if there is no source, Timer, Observer in the current mode, then exit directly Runloop

When does the auto-release pool release?
Release before Runloop sleep (kcfrunloopbeforewaiting)

How do I use runloop in development? What application scenario?
Open a resident thread (let a child thread not go extinct, wait for other threads to send messages, handle other events)
Turn on a timer in a sub-thread
Perform some long-term monitoring in a child thread

IOS Interview Runloop

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.