[cpp-threads] Thread try/time_join (was: Asynchronous FunctionProposal)

Boehm, Hans hans.boehm at hp.com
Wed Jun 3 23:06:50 BST 2009


> From:  Howard Hinnant
> 
> I also note that boost::thread now supports timed_join, both 
> relative and absolute variants. ;-)
My concern remains that all the obvious use cases for these seem to be incorrect and some of them are potentially quite dangerous.  Unless we come up with really clever solutions for N2880.

> 
> Still, once Anthony put interrupt() into boost::thread, he 
> pretty much doomed std::thread to DOA (and rightly so).
Except that for now we still get a choice between absolutely no interruption mechanism (std::thread) and detach-on-thread-destruction resulting in stack overwrites on exception (boost::thread).  Pick your poison :-( .

I know I shouldn't suggest this, (for many reasons, including the fact that I haven't thought it through enough) but what if we added a modified version of boost's
thread::interrupt() that implicitly included a join() call?  That would remove a potential source of object-lifetime-related bugs.  It would also make it very hard to ignore a thread_interrupted exception for long.  Would it avoid the long-standing objections to having such exceptions ignored?

Hans
> 
> -Howard
> 
> 
> --
> cpp-threads mailing list
> cpp-threads at decadentplace.org.uk
> http://www.decadentplace.org.uk/cgi-bin/mailman/listinfo/cpp-threads
> 


More information about the cpp-threads mailing list