
I would like to have a function object that I can use the return value of its operator() function. Here is what I think best explains my request class Apple { public: int operator()( int x ) { int value = x * 2; return value; } } void main (int, char**) { int thread_count = 2; // 2-Core cpu // Create a pool of Apple threads typedef boost::shared_ptrboost::thread Thread_Ptr_t; typedef std::list < Thread_Ptr_t > Thread_Pool_t; Thread_Pool_t m_thread_pool; // Create threads for ( int index = 0; index < thread_count; ++index ) { Thread_Ptr_t new_thread_ptr ( new boost::thread ( boost::bind ( &Apple, _1, )( index ) ) ); m_thread_pool.push_back ( new_thread_ptr ); } // Wait for all threads to finish for ( Thread_Pool_t::iterator pos = m_thread_pool.begin(); pos != m_thread_pool.end(); ++pos ) { (*pos)->join(); } } Where is the point I should be catching return from the operator() function? I want the thread to do work and then have the opportunity to get some results from it. Is there a code example someone can show me? Stephen