How it works...

The application is intentionally created to crash under certain conditions and does not provide enough information to be able to nail down to these conditions. The application consists of two major functions – runner and delay_ms

The runner function accepts three parameters—the time limit, the function of one parameter, and the function parameter value. It runs the function provided as a parameter, passing it the value, and measures the elapsed time. If the time exceeds the time limit, it throws an exception.

The delay_ms function performs a delay. However, it is implemented incorrectly and considers each millisecond as consisting of 1,100 microseconds instead of 1,000. 

The main function runs the runner in the loop directory, ...

Get Embedded Programming with Modern C++ Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.