Subj : Re: pthread function behavior in C++ program To : comp.programming.threads From : David Butenhof Date : Sun Jun 12 2005 10:45 pm wij@seed.net.tw wrote: > For the moment before The Standard, is it defensive enough to rewrite > my C++ programs on the base known -fact?- that: > 1. C system functions that are cancellation points implemented in the > C++ library(Linux Fedora3+NPTL) will initiate stack unwinding on > thread cancellation. > 2. The cancellation initiated stack unwinding might provide no type > to catch. > 3. The final stuff as how to handle the unspecifed throw type is also > yet unspecified. > > I just want something like this definite, as those that I could have > read so far just says similar things but definite to what I can use. "Facts" can be relative. For at least recent versions of NPTL, I believe your statements are essentially correct. You'd be SAFER not to use cancellation with C++; your code will be more portable that way, and less likely to have problems later if there is eventually a standard for threading C++ that differs from the current NPTL implementation. You need to decide whether it's more important to "defend" against possible changes (and be adaptable to other implementations), or to take advantage of what's there now on a particular platform. That's an application architectural design decision you'll need to make for yourself. -- Dave Butenhof, David.Butenhof@hp.com HP Utility Pricing software, POSIX thread consultant Manageability Solutions Lab (MSL), Hewlett-Packard Company 110 Spit Brook Road, ZK2/3-Q18, Nashua, NH 03062 .