[c++-pthreads] Re: thread-safety definition
Alexander Terekhov
boo at terekhov.de
Wed Jan 21 14:32:29 UTC 2004
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.
More information about the c++-pthreads
mailing list