[英]Background tasks run forever?
I am a little confused with background tasks. 我对后台任务有些困惑。 I've finished making one with the help of this tutorial .
在本教程的帮助下,我已经完成了一个。 The tutorial says this:
本教程说:
Create a background task class and register it to run when your app is not in the foreground
创建一个后台任务类,并注册它以在您的应用程序不在前台时运行
However, my background task runs even if it is in the foreground. 但是,我的后台任务即使在前台也可以运行。
Is this intended behavior, that it runs whether or not the app is in the foreground? 这是否是预期的行为,无论应用程序是否在前台都可以运行? Is the presentation just not clear?
演讲不清楚吗?
Background tasks run asynchronously on a thread pool thread, no matter what. 无论如何,后台任务都在线程池线程上异步运行。 Which means it doesn't matter whether your app is in the foreground or not.
这意味着您的应用程序是否在前台都没有关系。 Once it kicks, its running.
一旦启动,它就会运行。
Great links on BG tasks here - https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/monitor-background-task-progress-and-completion . 有关BG任务的重要链接-https: //msdn.microsoft.com/zh-cn/windows/uwp/launch-resume/monitor-background-task-progress-and-completion 。
Great paper on background tasks at https://www.microsoft.com/en-us/download/details.aspx?id=27411 . 有关后台任务的出色论文, 网址为https://www.microsoft.com/zh-cn/download/details.aspx?id=27411 。 Still relevant even though its 8.1.
即使它的8.1仍然有意义。
a background thread is drawn from the thread pool, and it meant to run in the background. 从线程池中提取了一个后台线程,它打算在后台运行。 your UI thread is the main thread, likely it is run on the foreground.
您的UI线程是主线程,可能在前台运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.