2011-01-25 66 views
2
class accel{ 
public: 
    accel(int threads, string params); 

private: 
    void getfile(int from, int to); 
    void download(int threads); 
}; 


void accel::download(int threads){ 
    boost::thread g(&getfile(0, 1)); //<<<< 
} 

给出错误'&'需要l值。我一直在做这个例子。如何使它工作?提升。多线程

回答

6
boost::thread g (boost::bind(&accel::getfile, this, 0, 1)); 
+0

如何让一个线程在关闭之前等待其他线程关闭?互斥? – gemexas 2011-01-25 12:10:29

2

getfile回报void - 你正在试图采取void类型的变量的地址。这根本没有任何意义。你将不得不使用绑定的函数对象 - 检查boost :: bind。