线程里面用智能指针传递复杂类型的参数

  // std::queue spsc_queue[MAXQUESIZE];
    // auto sptr_queue = std::make_shared>();
    auto ptr = std::shared_ptr<std::queue<cv::Mat>>(spsc_queue);
     std::thread mythread22(testPTR, ptr);
    mythread22.join();
    for (int i = 0; i < 10000; i++) {
    }
    std::cout << "thread finished!" << std::endl;

    std::cout<< ptr->size();
    auto a = ptr->front();
    cv::imshow("img", a);
    cv::waitKey(0);

你可能感兴趣的:(C++,opencv,c++,算法)