[cxx-abi-dev] One-time Construction API (3.3.2)

Dennis Handly dhandly at cup.hp.com
Fri Aug 6 09:14:42 UTC 2004


>From: Jason Merrill <jason at redhat.com>
>> we seem to do the same for both.  And it is left on the atexit list
>> for the latter.

>Doing the same for both is wrong, I think; once construction of the object
>is complete, it's complete, whether or not the subsequent cleanup throws.

I guess we could reduce the size of the catch to not include the cleanup.

>>     try {
>>         /* initialize */
>>         __cxa_atexit(dtor);
>>         __cxa_guard_release(&guard);
>>     }
>>     catch(...) {
>>           __cxa_guard_abort(&guard);
>>     }

>Yes, here it looks like you incorrectly call abort rather than release if a
>cleanup throws.

I suppose we can use gotos or a flag so that __cxa_guard_abort is skipped.
There really should be a rethrow in the catch block.
       catch(...) {
             __cxa_guard_abort(&guard);
             throw;
       }
       // cleanup temps

>> We do use the second byte to handle (stop) recursion.

>I'm not sure what you mean.  If you already have a mutex, what are you
>using the second byte for?
Jason

In undefined case where the code to initialize the function scope static
recursively calls the current function.

(Note the single mutex is recursive to handle the defined case of multiple
function scope statics being used.)



More information about the cxx-abi-dev mailing list