小编ara*_*yq2的帖子

在 pthread_cancel 之后“终止调用而没有活动异常”

在探讨这个问题的条件时,出现了一个问题,以下面的代码为例。

#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)

c++ g++ pthreads c++11 stdthread

5
推荐指数
1
解决办法
1191
查看次数

标签 统计

c++ ×1

c++11 ×1

g++ ×1

pthreads ×1

stdthread ×1