开发者

boost::thread pool and boost::bind or boost::function

开发者 https://www.devze.com 2023-01-25 23:20 出处:网络
How can i get return value from a boost thread pool? i tried to attach a bound function to a boost::function:

How can i get return value from a boost thread pool?

i tried to attach a bound function to a boost::function:

boost::function f0; //void cause the parameter passed is al开发者_开发百科ways the same.

func = bind( static_cast(&MyClass::operator+),  this, arg );

MyClass obj;
threadpool.schedule( obj = &func() ) 

but it throws error: term does not evaluate to a function taking 0 arguments.

This is just the way i tried, it could be completely wrong...

How can i get the return value of a bound function? consider it has to be scheduled in a thread. Thank you in advance!!

0

精彩评论

暂无评论...
验证码 换一张
取 消