Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86749 - trunk/boost/interprocess/detail
From: igaztanaga_at_[hidden]
Date: 2013-11-18 04:33:36


Author: igaztanaga
Date: 2013-11-18 04:33:36 EST (Mon, 18 Nov 2013)
New Revision: 86749
URL: http://svn.boost.org/trac/boost/changeset/86749

Log:
Removed auto_ptr to avoid deprecation warnings in newer compilers.

Text files modified:
   trunk/boost/interprocess/detail/os_thread_functions.hpp | 30 +++++++++++++++++++++++++++---
   1 files changed, 27 insertions(+), 3 deletions(-)

Modified: trunk/boost/interprocess/detail/os_thread_functions.hpp
==============================================================================
--- trunk/boost/interprocess/detail/os_thread_functions.hpp Mon Nov 18 04:32:44 2013 (r86748)
+++ trunk/boost/interprocess/detail/os_thread_functions.hpp 2013-11-18 04:33:36 EST (Mon, 18 Nov 2013) (r86749)
@@ -512,9 +512,33 @@
 
 #if defined(BOOST_INTERPROCESS_WINDOWS)
 
+template<class T>
+class os_thread_func_ptr_deleter
+{
+ public:
+ explicit os_thread_func_ptr_deleter(T* p)
+ : m_p(p)
+ {}
+
+ T *release()
+ { T *p = m_p; m_p = 0; return p; }
+
+ T *get() const
+ { return m_p; }
+
+ T *operator ->() const
+ { return m_p; }
+
+ ~os_thread_func_ptr_deleter()
+ { delete m_p; }
+
+ private:
+ T *m_p;
+};
+
 inline unsigned __stdcall launch_thread_routine( void * pv )
 {
- std::auto_ptr<abstract_thread> pt( static_cast<abstract_thread *>( pv ) );
+ os_thread_func_ptr_deleter<abstract_thread> pt( static_cast<abstract_thread *>( pv ) );
    pt->run();
    return 0;
 }
@@ -525,7 +549,7 @@
 
 inline void * launch_thread_routine( void * pv )
 {
- std::auto_ptr<abstract_thread> pt( static_cast<abstract_thread *>( pv ) );
+ os_thread_func_ptr_deleter<abstract_thread> pt( static_cast<abstract_thread *>( pv ) );
    pt->run();
    return 0;
 }
@@ -551,7 +575,7 @@
 template<class F>
 inline int thread_launch( OS_thread_t & pt, F f )
 {
- std::auto_ptr<abstract_thread> p( new launch_thread_impl<F>( f ) );
+ os_thread_func_ptr_deleter<abstract_thread> p( new launch_thread_impl<F>( f ) );
 
    int r = thread_create(&pt, launch_thread_routine, p.get());
    if( r == 0 ){


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk