What is the relationship between C++ and the POSIX cleanup handlers?
>Ian Collins wrote: >> >> Stefan Seefeld wrote: >> > >> > Ian Collins wrote: >> > >> > > Cleanup handlers are not a good place to destroy objects, use some >> > > for of container object that to the object and delete it in its >> > > destructor >> > > (a smart pointer) to do this. >> > >> > that would indeed be the right thing, if….if thread cancelation >> > would do proper stack unwinding. >> > >> > Stefan >> >> I would hope it does – the Solaris one does. > >Only if you use Sun’s own compiler and even then – not always. From what I understand, in this compiler, when a thread is canceled, it acts as if some special exception was thrown which is never caught and which does not call unhandled()—in other words, just the unwinding is performed. What is the relationship between this unwinding and the POSIX cleanup handlers? Are these properly interleaved with the unwinding, or are they done first? In other words, what I’m asking is: are the POSIX cleanup handlers somehow hooked into th