Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ equivalent of .NET's Task.Delay?

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#.

like image 914
Tomas Avatar asked Dec 10 '12 18:12

Tomas


1 Answers

Old Question, but still unanswered.

You can use

#include <chrono>
#include <thread>


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

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

like image 159
Frieder Hofmann Avatar answered Sep 30 '22 05:09

Frieder Hofmann