如何通过在代码中运行多个进程来使 iPhone 过热
我看到了一些暖手器应用程序,我想通过同时运行多个进程来制作类似的东西非常容易。有人尝试过吗?如果您这样做了,您可以在这里与我们分享吗?
I saw some handwarmer apps and I guess it's very easy to make something like that by running multiple processes at once. Has anyone had a go on it? If you did, can you share it with us here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需找到一些无限重复的计算(例如查找 Pi 中的数字),然后启动三个或四个线程来执行它们 - 要么是并发计数设置为 4 的 NSOperationQueue,要么只是自己生成线程。
关键是让系统以某种方式工作,你可以使用CPU或GPU(或两者)。
Just find some endlessly repeating calculation (like something that finds the digits in Pi for example), and launch three or four threads performing them - either an NSOperationQueue with a concurrent count set to four, or just spawn off threads yourself.
The key is to make the system work in some way, you can either exercise the CPU or the GPU (or both).
您可以轻松地生成多个线程:
但这不是几个进程,而且可能不会预热机器。
You can easily spawn several threads:
That’s not several processes and probably does not warm the machine up, though.