Logo

Programming-Idioms

History of Idiom 45 > diff from v37 to v38

Edit summary for version 38 by programming-idioms.org:
[C] Fixed comment "man 1 usleep" -> "man 3 usleep"

Version 37

2016-12-30, 00:28:39

Version 38

2017-01-01, 22:02:06

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with next instructions.

Illustration

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with next instructions.

Illustration
Imports
#include <unistd.h>
Imports
#include <unistd.h>
Code
usleep(5000000);
Code
usleep(5000000);
Comments bubble
usleep is sleep in microseconds, not milliseconds as in Java.
See man 1 usleep
Comments bubble
usleep argument is in microseconds.
See : man 3 usleep