C++ 相当于 .NET 的 Task.Delay? [英] C++ equivalent of .NET's Task.Delay?

查看:37
本文介绍了C++ 相当于 .NET 的 Task.Delay?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个 C++/CX 组件,供 Window 的商店应用程序使用.我正在寻找一种方法来完成 Task.Delay(1000) 在 C# 中所做的事情.

I'm writing a C++/CX component to be consumed by Window's store Apps. I'm looking for a way to accomplish what Task.Delay(1000) does in C#.

推荐答案

老问题,但仍未得到解答.

Old Question, but still unanswered.

你可以使用

#include <chrono>
#include <thread>


std::this_thread::sleep_for(std::chrono::milliseconds(1000));

这将需要 C++11,这应该不是问题使用 C++/CX 时.

This will need C++11, which shouldn't be a problem when using C++/CX.

这篇关于C++ 相当于 .NET 的 Task.Delay?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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