Boost. Multithreading
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)); //<<<<
}
Gives an error '&' requires l-value. I开发者_如何学Python have been doing this by example. How to make it work?
boost::thread g (boost::bind(&accel::getfile, this, 0, 1));
getfile
returns void
- you are trying to take the address of a variable of type void
. That doesn't make any sense at all. You will have to use a bound function object- check out boost::bind.
精彩评论