I was reading through some questions on the General C++ Thread, and I came across the following code, from which I don't understand the two ;;'s:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <thread>
#include <chrono>
void fn()
{
for(;;)
{
std::this_thread::sleep_for(std::chrono::seconds(1));
// <-- call your function here
}
}
int main()
{
std::thread(fn).detach();
// <- do something that takes more than a second here
}
Can anybody explain how this can be correct?
Thanks in advance!