
Sean Kelly wrote:
Peter Dimov wrote:
Andreas Huber wrote:
I think he meant the object indirectly referenced by boost::function:
MyActiveObject pActive = new MyActiveObject(); boost::thread myThread( boost::function< void () >( boost::bind( &MyActiveObject::Run, pActive ) ) ); delete pActive;
Why would anyone want to do that?
What if MyActiveObject has interface methods that need to be externally accessible? Message queue endpoints, for example. Though other program designs might obviate the need for such access methods.
Yes, that's how I would answer my own question, too. It would be interesting to see whether high-level components built on top of boost::thread can solve the interthread communication problem in an elegant way. But if we focus on the low-level layer, I think that this may be solved with a thread::target() accessor (similar to the newly added function<>::target()).