February 2020
Intermediate to advanced
292 pages
8h 54m
English
In this section, we'll write a program to learn how to put a program to sleep by using the different POSIX APIs that are available. We'll also look at the C++ alternative:
#include <iostream>#include <chrono>#include <thread> // sleep_for#include <unistd.h> // for sleep#include <time.h> // for nanosleep and clock_nanosleep
int main (){ std::cout << "Starting ... " << std::endl; auto start = std::chrono::steady_clock::now(); sleep (1); auto end = std::
Read now
Unlock full access