diff --git a/include/boost/detail/lightweight_thread.hpp b/include/boost/detail/lightweight_thread.hpp index 6fe70a6..2145815 100644 --- a/include/boost/detail/lightweight_thread.hpp +++ b/include/boost/detail/lightweight_thread.hpp @@ -77,8 +77,16 @@ public: extern "C" void * lw_thread_routine( void * pv ) { +#if defined(BOOST_NO_CXX11_SMART_PTR) + std::auto_ptr pt( static_cast( pv ) ); +#else + + std::unique_ptr pt( static_cast( pv ) ); + +#endif + pt->run(); return 0; @@ -88,8 +96,16 @@ extern "C" void * lw_thread_routine( void * pv ) unsigned __stdcall lw_thread_routine( void * pv ) { +#if defined(BOOST_NO_CXX11_SMART_PTR) + std::auto_ptr pt( static_cast( pv ) ); +#else + + std::unique_ptr pt( static_cast( pv ) ); + +#endif + pt->run(); return 0; @@ -117,8 +133,16 @@ private: template int lw_thread_create( pthread_t & pt, F f ) { +#if defined(BOOST_NO_CXX11_SMART_PTR) + std::auto_ptr p( new lw_thread_impl( f ) ); +#else + + std::unique_ptr p( new lw_thread_impl( f ) ); + +#endif + int r = pthread_create( &pt, 0, lw_thread_routine, p.get() ); if( r == 0 )