C++ // 将 Boost::array 传递给 Boost::thread
C++ // pass a Boost::array to Boost::thread
我想将"boost::array"传递给"booth::thread"作业。
typedef unsigned char BYTE;
boost::array<BYTE,256> readBuffer;
thread gojob(&thread_job, readBuffer.data() );
如何通过?
void serial::thread_job(BYTE *received) {
}
我写了这个..但编译只给了我奇怪的信息..我听不懂他在说什么。
include/boost/bind/mem_fn.hpp:333:36: error: cannot apply member pointer ‘((const boost::_mfi::dm<void(unsigned char*), serial>*)this)->boost::_mfi::dm<void(unsigned char*), serial>::f_’ to ‘* boost::get_pointer<unsigned char>(((unsigned char*)u))’, which is of non-class type ‘unsigned char’
传递缓冲区,然后处理 data(),你可以执行以下操作:
thread gojob(boost::bind(&serial::thread_job,this, boost::ref(readBuffer))
相关文章:
- 无法将参数传递给 boost::thread 构造函数
- 如何使用boost.thread运行多个接收器,每个线程应该分配给每个接收器?
- 使用 boost::thread 运行函子,但析构函数被错误地调用
- thread_specific_pointer可以在哪些平台上工作而无需 boost::thread?
- 将 boost::thread 与 C++11 std::mutex 混合使用是否安全?
- 同时使用 boost.python 和 boost.thread 时出现编译错误
- Boost.thread代码在Ubuntu和Windows中表现出不同的行为
- Pointer to boost::thread
- Linux上多核计算的低性能(openMP、boost::thread等)
- boost - thread.join() halts the ui
- 将基类的引用传递给 boost::thread 并在派生类中调用虚函数是否有效
- Difference between boost::thread and std::thread
- std::thread是boost::thread的替代品吗?
- 将 boost/thread headers 与 clang++ (Windows) 一起使用时出现问题
- 在linux下使用boost::thread创建一个boost::asio工作线程
- 如何在Windows上的CodeBlocks中构建和配置boost.thread
- C++ ReadConsoleInput 不适用于 boost::thread
- Boost.Thread超时等待
- 如何使用boost::thread创建线程池
- 使用std::vector和boost::thread进行内存管理