[UWP] [C ++]使用代码创建并注册进程外后台任务帮助? [英] [UWP][C++]Create and register an out-of-process background task help with code?

查看:71
本文介绍了[UWP] [C ++]使用代码创建并注册进程外后台任务帮助?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

示例是:
创建并注册进程外后台任务

代码为:

        //
        // TODO: Modify the following line of code to call a real async function.
        //       Note that the task<void> return type applies only to async
        //       actions. If you need to call an async operation instead, replace
        //       task<void> with the correct return type.
        //
        task<void> myTask(ExampleFunctionAsync());

        myTask.then([=] () {
            deferral->Complete();
        });

什么是异步函数?

有人可举例说明:

 task<void> myTask(ExampleFunctionAsync());

谢谢。

推荐答案

PaulGGriffiths,



>>什么是异步函数?

线程和异步编程使您的应用程序能够在并行线程中异步完成工作。您可以参考
了解更多信息线程和异步编程

Asynchronous编程

至于你的第二个问题,我认为
C ++中的异步编程

在C ++中为Windows应用商店应用创建异步操作
将是您想要的。在文档中,您可以了解有关Task和Async的更多详细信息,并且有许多示例代码可以帮助您理解它。



祝你好运,

Breeze Liu

As for your second issue, I think the Asynchronous programming in C++ and Creating Asynchronous Operations in C++ for Windows Store Apps will be what you want. In the document, you can learn more details about the Task and Async and there are many example code which can help you understand it.

Best regards,
Breeze Liu


这篇关于[UWP] [C ++]使用代码创建并注册进程外后台任务帮助?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆