Hi,
I have three thread in myu program without main thread.
I want one milisecond sleep for each three thread.
What i do?
For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
void test ()
{
Sleep one milisecond.
}
void test 2()
{
Sleep one milisecond.
}
void test 3()
{
Sleep one milisecond.
}
void main ()
{
thread t1(test 1);
thread t2(test 2);
thread t3(test 3);
}
|
Last edited on
Great answer.
But can you explane this?
this_thread::sleep_for(chrono::milliseconds(5));
What means chrono?!
Last edited on
std::chrono is a standard namespace found in the namespace std. This was included in C++11, and contains almost all functions concerning time in C++.
Aceix.