Re: exception not caught? (aborting)
Re: exception not caught? (aborting)
- Subject: Re: exception not caught? (aborting)
- From: Avi Drissman <email@hidden>
- Date: Sat, 28 Mar 2009 21:44:12 -0400
Right. That's the reason for the general rule to
never throw an exception from a destructor.
Avi
On Sat, Mar 28, 2009 at 9:41 PM, Ethan Tira-Thompson
<email@hidden> wrote:
Nevermind... I have discovered if you throw an exception from a destructor during a stack unwind from another exception, this immediately triggers a std::terminate. Such as in my case, a mutex being unlocked during the unwind also checked for thread cancellation and reposted the thread cancelation exception, causing the sudden terminate.
For reference in future search results, it seems if you see these in the stack trace:
#7 0x9060f5ee in _Unwind_Backtrace ()
#8 0x9060f794 in _Unwind_RaiseException ()
...then that suggests it's a destructor re-throw. (I wouldn't know if there are other times these also show up, but in my testing that's the only time I see it)
FWIW, it sure would be nice if pthread_cancel did a C++ destructor aware stack unwind on darwin like it does on linux so I wouldn't have to do this exception stuff manually to reimplement it... just say'n ;)
Thanks,
-Ethan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden