如何通过在代码中运行多个进程来使 iPhone 过热

发布于 2024-08-27 00:41:53 字数 74 浏览 4 评论 0原文

我看到了一些暖手器应用程序,我想通过同时运行多个进程来制作类似的东西非常容易。有人尝试过吗?如果您这样做了,您可以在这里与我们分享吗?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你的他你的她 2024-09-03 00:41:53

只需找到一些无限重复的计算(例如查找 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).

街角迷惘 2024-09-03 00:41:53

您可以轻松地生成多个线程:

- (void) reticulateSplines {
    while (1) ;
}

- (void) spawnThreads {
    for (int i=0; i<kNumberOfThreads; i++)
        [self performSelectorInBackground:@selector(reticulateSplines)
              withObject:nil];
}

但这不是几个进程,而且可能不会预热机器。

You can easily spawn several threads:

- (void) reticulateSplines {
    while (1) ;
}

- (void) spawnThreads {
    for (int i=0; i<kNumberOfThreads; i++)
        [self performSelectorInBackground:@selector(reticulateSplines)
              withObject:nil];
}

That’s not several processes and probably does not warm the machine up, though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文