Re: [c++-pthreads] Re: thread-safety definition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [c++-pthreads] Re: thread-safety definition



David Abrahams wrote:
[...]
> > The issue we've been discussing is not whether there are exceptions,
> > or where they are, but rather how to "warp" our basic theoretically
> > clean model to deal with the reality that C++ libraries (including
> > STL) are rife with arbitrary catch(...) blocks that stop exceptions;
> > often with no really supportable reason except that it seemed
> > convenient at the time.
> 
> Excuse me, but that is just wrong.  

Bah. http://www.boost.org/libs/smart_ptr/sp_techniques.html

"One subtle point is that deleters are not allowed to throw 
 exceptions, and the above example as written assumes that 
 p_.reset() doesn't throw. If this is not the case, 
 p_.reset() should be wrapped in a try {} catch(...) {} 
 block that ignores exceptions.

 [...]

 Another variation is to move the free list logic to the 
 construction point by using a delayed deleter:

 struct delayed_deleter
 {
     template<class T> void operator()(T * p)
     {
         try
         {
             shared_ptr<void> pv(p);
             free_list.push_back(pv);
         }
         catch(...)
         {
         }
     }
 };"

regards,
alexander.