C++11부터 제공되는 기능으로,

현재 스레드를 주어진 시간(여기서는 300 밀리초) 동안 정지시키는 역할을 합니다.

 

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

#include <chrono>
#include <thread>

int main() {
    // 300 밀리초 동안 현재 스레드를 일시 정지
    std::this_thread::sleep_for(std::chrono::milliseconds(300));
    
    // 다음 작업을 수행
    // ...
    
    return 0;
}

 

업무에 필요한 상황이 생겨서 찾아보고 적용한 코드입니다.

 

잘 동작하네요 :)

728x90
반응형

+ Recent posts