在探讨这个问题的条件时,出现了一个问题,以下面的代码为例。
#include <iostream>
#include <thread>
#include <chrono>
#include <stdexcept>
#include <cxxabi.h>
using namespace std;
// mocking external library call stuck in a strictly user-land infinite loop
int buggy_function_simulation()
{
// cout << "In buggy function" << endl; // (1)
int counter = 0;
while (true)
{
if ( ++counter == 1000000 ) { counter = 0; }
}
return 0;
}
int main(int argc, char **argv) {
cout << "Hello, world!" << endl;
auto lambda = []() { …Run Code Online (Sandbox Code Playgroud)