Ticket #1958: tss_cleanup.patch
File tss_cleanup.patch, 1.3 KB (added by , 14 years ago) |
---|
-
pthread/tss.hpp
56 56 } 57 57 }; 58 58 59 struct noop_cleanup_function: 60 detail::tss_cleanup_function 61 { 62 void operator()(void*) 63 { 64 } 65 }; 59 66 67 60 68 boost::shared_ptr<detail::tss_cleanup_function> cleanup; 61 69 62 70 public: … … 64 72 cleanup(new delete_data) 65 73 {} 66 74 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)) 68 78 {} 69 79 ~thread_specific_ptr() 70 80 { -
win32/tss.hpp
51 51 52 52 void operator()(void* data) 53 53 { 54 cleanup_function(static_cast<T*>(data));54 if (cleanup_function) cleanup_function(static_cast<T*>(data)); 55 55 } 56 56 }; 57 57