Re: [c++-pthreads] Restating the Jason model
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [c++-pthreads] Restating the Jason model
- To: Dave Butenhof <David.Butenhof@xxxxxx>
- Subject: Re: [c++-pthreads] Restating the Jason model
- From: Alexander Terekhov <boo@xxxxxxxxxxx>
- Date: Tue, 13 Jan 2004 14:59:11 +0100
Dave Butenhof wrote:
[...]
> Absolutely; because the correct behavior of the application (which might
> be distributed) could depend on being able to notify the remote partner
> that the local thread is shutting down. Nathan's proposal doesn't allow
> that, and that's the big weakness.
Nathan's proposal does allow that (not that I really like Nathan's
proposal). You'd simply have to manually disable cancelation. Think of
"traditional" pthread_cleanup_pop(!0) handlers.
>
> Jason's proposal will cause the cancel to be re-asserted when the
> exception object is destroyed, on exit from the catch(), after local
> cleanup has been done. This makes the catch() behave (more or less) like
> a destructor.
And that's "the big" weakness. catch() != destructor.
void operation() throw(std::thread_cancel_request);
void f() {
try {
operation();
}
catch(...) {
pthread_exit("Wow, canceled."); // or something like that
}
/* ... */
}
regards,
alexander.