A
A
Anton Savchenko2015-10-22 17:49:02
Programming
Anton Savchenko, 2015-10-22 17:49:02

How to suspend the main and only thread in C++?

I want to make a watch. I only need to put the main thread to sleep for a second. How can I do it? I didn't find anything on the Internet.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MiiNiPaa, 2015-10-22
@Lapital

C++11:

std::this_thread::sleep_for(std::chrono::seconds(1));

V
Vladimir Martyanov, 2015-10-22
@vilgeforce

It's strange that they didn't find it. For Windows - Sleep(1000), for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question