Run Loops
A run loop is a piece of infrastructure used to manage events arriving asynchronously on a thread. A run loop
works by monitoring one or more event sources for the thread. As events arrive, the system wakes up the
thread and dispatches the events to the run loop, which then dispatches them to the handlers you specify. If
no events are present and ready to be handled, the run loop puts the thread to sleep.
You are not required to use a run loop with any threads you create but doing so can provide a better experience
for the user. Run loops make it possible to create long-lived threads that use a minimal amount of resources.
Because a run loop puts its thread to sleep when there is nothing to do, it eliminates the need for polling,
which wastes CPU cycles and prevents the processor itself from sleeping and saving power.
To configure a run loop, all you have to do is launch your thread, get a reference to the run loop object, install
your event handlers, and tell the run loop to run. The infrastructure provided by both Cocoa and Carbon
handles the configuration of the main thread’s run loop for you automatically. If you plan to create long-lived
secondary threads, however, you must configure the run loop for those threads yourself.
- 大小: 115.2 KB
分享到:
相关推荐
iOS Runloop官方文档翻译.Run loops 是线程相关的的基础框架的一部分。一个 run loop 就是一个事件处理 的循环,用来不停的调度工作以及处理输入事件。使用 run loop 的目的是让你的线 程在有工作的时候忙于工作,...
ios runloops 四个测试用例
“Run Loops” 提供有关如何管理在辅助线程中的循环事件处理的信息。 “同步(Synchronization)” 介绍同步问题和你可以用于阻止多线程破坏你 的数据或者导致你程序崩溃的工具。 “线程安全总结” 提供了 ...
1.4.2 Run Loops ....................................................................................................... 6 1.4.3 同步工具 .................................................................
介绍ios 多线程开发的书籍, 第一章 关于多线程编程 第二章 线程管理 第三章 Run Loops 第四章 线程同步
请自愿留下你的 Star >RuntimeRuntime 博文推荐(:red_heart:相对较多者)作者模块标题卖报的小画家SureMethod Swizzling开发实例汇总滕大鸟最实用的runtime总结黑花白花实际开发中的应用Run LoopsRun Loops 官方...
Practice JavaScript basics - operators, conditions, loops 提交方式 Upon completion, run the following commands: git add . git commit -m "ProGrad ID" git push origin master And finally, create a pull ...
* for gaps, edits & repairs < 1000ms eac3to now loops audio by default * option "-silence" forces eac3to to insert silence instead of looping audio * option "-loop" forces eac3to to loop audio instead...
使用回溯算法对输入图中的所有循环进行计数,直至(可选)指定的大小限制。 专为没有自环或多边的无向图而设计。... 在实践中,该算法比 Joe Kirk (run_loops.m) 发布的 ILCA 循环计数算法快得多。
AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying "runtimes" required! AutoIt was initially designed for PC "roll out" situations to ...
run_loops.m) 运行所有代码,无需GUI界面 用于计数循环的算法是我开发的一个迭代过程,我称之为 ILCA(迭代循环计数算法)。 它将网络转换为一棵树,并在树上进行*深度优先*搜索以获取循环。 这是一种*蛮力*技术...
Run 2 loops with variables i and j. Compare string at i and j. If they become equal at any point, return false. for (int i=0; i < str.length() - 1; i++) for ( int j=i+1; j<str.length(); j++) if...
Each sample is thoroughly explained, and though the style in this book is occasionally dense, it does manage to give plenty of practical advice on how to make code run in parallel efficiently....
The B50610 is a highly integrated solution combining digital adaptive equalizers, ADCs, phase-locked loops, line drivers, encoders, decoders, echo cancellers, crosstalk cancellers, and all required ...
Get your systems updated to the latest Linux kernel and Bash shell to run your administration tasks efficiently. Get to grips with the fundamentals of creating and running a script in normal mode, ...
First you’ll see how to run basic calculations, absorbing technical complexities incrementally as you progress toward advanced topics. Throughout, the language is kept simple to ensure that readers ...
You will also learn about: Programs in Files, variables and Strings Loops and Conditional Statements While Loops Boolean Operators Conditional Statements Functions Tuples, Lists, and Dictionaries ...
What are Arrays, Strings, Conditionals, Loops and more How to do Functions How to work with Constructors, Inheritance, Overridings How to use Access Levels, Static, Enum, String and Union, and more ...
# 目的是掌握IEEE的转换功能。 numeric_std软件包(请参阅提供的文件“ VHDL_1164pkg.pdf”)来解决 VHDL。 # Describe in behavioral VHDL a modulo-m up/...– Run behavioral simulation – Waveform configuration
The Keras functional and subclassing APIs provide a define-by-run interface for customization and advanced research. Build your model, then write the forward and backward pass. Create custom layers, ...