boost线程列表
boost thread list
我有类似于下面的代码。下面的代码给出了SIGSEGV,并指向list::push_back。这是使用提升线程列表的正确方式吗?
struct mythread{
static void myfunc() {
while(1){ }
}
};
int f(){
std::list<boost::thread *> pool;
pool.push_back(new boost::thread(mythread::myfunc));
}
环境:Ubuntu上的gcc 4.4.5,与libboost_thread.a和-lpthread链接。我没有使用c++0x标志。
问候,
Chubsdad
注2:我还得到了代码的SIGSEGV
pool.push_back(new boost::thread(NULL);
尝试获取函数指针的地址:
pool.push_back(new boost::thread(&mythread::myfunc));
相关文章:
- 如何在不复制列表的情况下将列表传递给线程,同时销毁原始列表
- C++中向量和列表的非写入成员函数的线程安全性
- Xcode:线程1:exc_bad_access(代码= 1,地址= 0x0)在缩短列表时
- 条件_variable和unique_lock如何适用于线程安全列表
- 在为工作线程访问 lambda 中捕获的向量列表中的元素引用时,是否需要互斥锁?
- 慢速插入链接列表需要多线程
- 在C 中共享线程之间的列表
- 可以在构造函数初始值设定项列表中使用标准::线程
- 正确的线程调用语法?错误:没有匹配对 std::thread::thread(<大括号括起来的初始值设定项列表>)
- 列表和多线程环境
- 访问列表项时的 UI 和工作线程同步
- C++ STL 算法(列表排序)OpenMP/多线程实现
- 如何从win32进程中获取线程句柄列表
- 如何从另一个线程更新列表视图
- 在CUDA内核中填充一个数组或列表,但不是在每个线程中
- 如何在迭代列表时最小化互斥锁,同时能够添加来自另一个线程的元素
- 将 rng 的列表存储在 std::array 中以进行多线程处理
- boost线程列表
- C++从线程 ID 列表中查找 GUI 线程
- 从不同的线程同步访问和删除列表中的项