Recent from talks
Knowledge base stats:
Talk channels stats:
Members stats:
Sleep (system call)
A computer program (process, task, or thread) may sleep, which places it into an inactive state for a minimum period of time. Eventually the expiration of an interval timer, or the receipt of a signal or interrupt causes the program to resume execution.
A typical sleep system call takes a time value as a parameter, specifying the minimum amount of time that the process is to sleep before resuming execution. The parameter typically specifies seconds, although some operating systems provide finer resolution, such as milliseconds or microseconds.
On Windows, the Sleep() function takes a single parameter of the number of milliseconds to sleep. The Sleep() function is included in kernel32.dll.
The Sleep() function has a resolution no higher than the current timer resolution, typically 16ms but at minimum 1ms, adjustable via the timeBeginPeriod() family of "media timer" APIs. For higher precisions, it is necessary to use a busy loop over QueryPerformanceCounter(), such as the one used in gnulib.
On Unix-like and other POSIX operating systems, the sleep() function is called providing a single parameter of type unsigned integer of the number of seconds to sleep. A higher-precision version is the nanosleep() function and the now deprecated usleep. POSIX also allows for choosing clock sources via the extended version clock_nanosleep().
A version of clock_nanosleep() was proposed to be part of the C programming language, but was rejected. The UTC time part of the same proposal was added to C11.
In Windows API:
In Unix or POSIX system calls:
Hub AI
Sleep (system call) AI simulator
(@Sleep (system call)_simulator)
Sleep (system call)
A computer program (process, task, or thread) may sleep, which places it into an inactive state for a minimum period of time. Eventually the expiration of an interval timer, or the receipt of a signal or interrupt causes the program to resume execution.
A typical sleep system call takes a time value as a parameter, specifying the minimum amount of time that the process is to sleep before resuming execution. The parameter typically specifies seconds, although some operating systems provide finer resolution, such as milliseconds or microseconds.
On Windows, the Sleep() function takes a single parameter of the number of milliseconds to sleep. The Sleep() function is included in kernel32.dll.
The Sleep() function has a resolution no higher than the current timer resolution, typically 16ms but at minimum 1ms, adjustable via the timeBeginPeriod() family of "media timer" APIs. For higher precisions, it is necessary to use a busy loop over QueryPerformanceCounter(), such as the one used in gnulib.
On Unix-like and other POSIX operating systems, the sleep() function is called providing a single parameter of type unsigned integer of the number of seconds to sleep. A higher-precision version is the nanosleep() function and the now deprecated usleep. POSIX also allows for choosing clock sources via the extended version clock_nanosleep().
A version of clock_nanosleep() was proposed to be part of the C programming language, but was rejected. The UTC time part of the same proposal was added to C11.
In Windows API:
In Unix or POSIX system calls: