[c++-pthreads] Re: thread-safety definition
Ross Smith
r-smith at ihug.co.nz
Mon Jan 12 15:52:19 UTC 2004
On Tuesday 13 January 2004 02:41, Dave Butenhof wrote:
>
> I think I disagree, at least philsophically, with the
> characterization of the model as "fragile". But I think I also
> understand what you mean; and the problem isn't with the model, but
> rather with the effect of that model on existing code that
> all-too-casually and agressively eats exceptions it doesn't
> understand. I think there are vanishingly few circumstances where a
> blind catch(...) without an unconditional re-throw should be
> considered "legitimate".
I'm beginning to get the same worried feeling Wil Evers expressed a few
messages back. It sounds as though a lot of people are seriously
considering the idea of allowing exceptions to escape from destructors.
Dave, while I have the greatest respect for your knowledge and
understanding of threads, I think the above shows that you don't really
understand C++. Please try to understand that it is _absolutely vital_
that destructors never be allowed to throw under any circumstances. If
a destructor calls a function that may throw some unknown exception (a
very common case, especially in template classes whose destructors will
often call member functions of some arbitrary user-supplied type), the
call _must_ be wrapped in a catch-and-discard-all block. At most you
can log the error somewhere.
Any attempt to standardise a solution that doesn't take "Destructors
Must Not Throw" as axiomatic is simply going to be a non-starter as far
as C++ programmers are concerned. I'd really like to see this list
explicitly address this issue rather than continuing to casually talk
about uncatchable exceptions and similar horrors.
--
Ross Smith ......... r-smith at ihug.co.nz ......... Auckland, New Zealand
"This world is like a burnt steak: small, tough, and the chips
are always stacked against you." -- Mike
More information about the c++-pthreads
mailing list