[SPAM] - Re: [c++-pthreads] pthread_cancel and EH: let's try this again - Email found in subject

David Abrahams dave at boost-consulting.com
Tue Jul 19 02:54:02 UTC 2005


Ted Baker <baker at cs.fsu.edu> writes:

>> My analogy was "gotos", for which the safe pattern 
>
> My point is still that (raw) exceptions are not a simple feature
> to use correctly, generally tend to get programmers in trouble,
> and don't need any "help" that will encourage people to try to
> use them for more unsafe things.

That's as wrong as saying that exceptions magically solve all your
error handling problems.

> The idea of thread cancellation is very simple and very appealing,
> so programmers to are told about it will seize on it as a panacea.
> I've seen this among students in the courses where I teach
> programming with threads (using C).
>
> Such naive programmers will write a program using threads, and
> then try to shut a thread or threads down by just cancelling them.
> They do not fully understand the ramifications of the thread
> cancellation model, use whatever libraries are at hand, and do not
> design from the beginning with cancellation in mind.  As a result,
> they run into trouble, such as lockups due to cancellation or
> threads that are holding mutexes on which another thread is
> depending for a pthread_cond_signal to wake up.

All of that is totally independent of exception-handling.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the c++-pthreads mailing list