Visual Studio13创建线程和优化进程
Visual Studio13 Creating Threads and Optimizing Process
我在VS13中编写多个线程
函数声明:
void getColorImage(HANDLE &colorEvent, HANDLE &colorStreamHandle, Mat &colorImage);
void getDepthImage(HANDLE &depthEvent, HANDLE &depthStreamHandle, Mat &depthImage);
void getSkeletonImage(HANDLE &skeletonEvent, Mat &skeletonImage, Mat &colorImage, Mat &depthImage, ofstream& myfile);
int main()
{
// this is inside a while loop
std::thread first(getColorImage, colorEvent, colorStreamHandle, colorImage);
std::thread second(getDepthImage, depthEvent, depthStreamHandle, depthImage);
std::thread third(getSkeletonImage, skeletonEvent, skeletonImage, colorImage, depthImage, myfile);
first.join();
second.join();
third.join();
}
但是,我得到一个错误:
我不知道为什么……有人能帮帮我吗?错误1错误C2280: 'std::basic_ofstream>::basic_ofstream(const std::basic_ofstream> &)':试图引用已删除的函数c:program files (x86)microsoft visual studio 12.0vcincludetype_traits 1545 1 skeleton_rgbdepth_dataprocetion2013
std::thread
构造函数与std::bind
一样,按值获取其所有参数。但是std::ofstream
有一个delete
d复制构造函数,因此出现错误。
用std::ref
包裹所有应该通过引用传递的参数
相关文章:
- boost::进程间消息队列引发错误
- 空基优化子对象的地址
- 在进程中对同一管道进行读取和写入时C++管道出现问题
- 是否可以通过C++扩展强制多个python进程共享同一内存
- IPC使用多个管道和分支进程来运行Python程序
- 关闭||运算符优化
- 异常属于C++中的线程还是进程
- 如何解决gcc编译器优化导致的centos双编译器设置中的分段错误
- WMI检测进程创建事件-c++
- 返回值优化:显式移动还是隐式
- 人脸跟踪arduino代码的优化
- 使用仅使用一次的变量调用的复制构造函数.这可能是通过调用move构造函数进行编译器优化的情况吗
- c++多进程编写一个唯一的文件
- 如何在C++中将函数发送到另一个进程
- 纯函数,为什么没有优化
- 为什么大多数 pair 实现默认不使用压缩(空基优化)?
- 在Qt Creator中,如何在连接到正在运行的进程后查看控制台输出
- 如何以优化的方式同时迭代两个间距不相等的数组
- 优化吞吐量:多线程与多进程
- Visual Studio13创建线程和优化进程