سؤال

I read an article on BackgroundTasks: TimeTrigger and MaintenaceTrigger.

Here they demonstrate how these triggers can be used to download email. I'm trying to understand the practicality and appropriateness of this approach.

Quotas for BackgroundTasks on LockScreen are 2 seconds CPU time and non-LockScreen is 1 second CPU time.

Given this restriction, how is it possible that one can download emails in this amount of time? Surely, just establishing a connection to the remote server will take more time than that?

Am i misunderstanding something about how BackgroundTasks work or is this article inaccurate?

http://blogs.msdn.com/b/windowsappdev/archive/2012/05/24/being-productive-in-the-background-background-tasks.aspx

هل كانت مفيدة؟

المحلول

CPU Time is not the same as the amount of seconds that have passed. Your link references a Word Document, Introduction to Background Tasks, which contains the following:

CPU usage time refers to the amount of CPU time used by the app and not the wall clock time of the background task. For example, if the background task is waiting in its code for the remote server to respond, and it is not actually using the CPU, then the wait time is not counted against the CPU quota because the background task is not using the CPU.

If you are establishing a connection to the mail server (and waiting for it to respond), then you are not using any CPU. This means the time that you spent waiting is not counted against you.

Of course, you will want to test your background task to make sure that it stays within the limits.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top