Table of Contents

C - C++ Threads - Pause current thread

pause.hpp

#pragma once
 
void pause(int milliseconds);

pause.cpp

#include "pause.hpp"
#include <thread>
#include <chrono>
 
void pause(int milliseconds)
{
  std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
}

References

https://en.cppreference.com/w/cpp/thread/sleep_for