Skip to content

C:sleep

Suspend execution for an interval of time. 즉, 일정 시간동안 Thread를 중지한다.

SYNOPSIS

#include <unistd.h>
unsigned int sleep(unsigned int seconds);

Windows version

UNIX버전 sleep은 초(Seconds)단위 지만, Windows API는 밀리초(Millisec)단위이다. 이 차이점은 아래와 같이 적용하면 된다.

#ifdef __unix__
# include <unistd.h>
#elif defined _WIN32
# include <windows.h>
# define sleep(x) Sleep(1000 * x)
#endif

See also

Favorite site