2011-01-25 138 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。