Ticket #1958: tss_cleanup.patch

File tss_cleanup.patch, 1.3 KB (added by Bryan Green <bryan.d.green@…>, 14 years ago)

patch to apply at ROOT/boost/thread for NULL cleanup_function support

  • pthread/tss.hpp

     
    5656            }
    5757        };
    5858
     59        struct noop_cleanup_function:
     60            detail::tss_cleanup_function
     61        {
     62            void operator()(void*)
     63            {
     64            }
     65        };
    5966
     67
    6068        boost::shared_ptr<detail::tss_cleanup_function> cleanup;
    6169       
    6270    public:
     
    6472            cleanup(new delete_data)
    6573        {}
    6674        explicit thread_specific_ptr(void (*func_)(T*)):
    67             cleanup(new run_custom_cleanup_function(func_))
     75            cleanup(func_ ?
     76                    static_cast<detail::tss_cleanup_function*>(new run_custom_cleanup_function(func_)) :
     77                    static_cast<detail::tss_cleanup_function*>(new noop_cleanup_function))
    6878        {}
    6979        ~thread_specific_ptr()
    7080        {
  • win32/tss.hpp

     
    5151           
    5252            void operator()(void* data)
    5353            {
    54                 cleanup_function(static_cast<T*>(data));
     54                if (cleanup_function) cleanup_function(static_cast<T*>(data));
    5555            }
    5656        };
    5757