[omniORB] Throwing exception from the ~omni_condition and
~omni_mutex
Serguei Kolos
Serguei.Kolos at cern.ch
Tue May 11 13:51:58 BST 2004
Hello
I have noticed that sometime my applications crash because the
omni_thread_fatal
exception, which is thrown from omni_condition or omni_mutex
destructors, is not
handled.
I would propose to remove exception throwing from these destructors by
two reasons:
1. It's not clear how to handle them. If I declare omni_condition as an
attribute of my
class then I have no way to catch such exception in this class. It
can be handled
outside the class, but this is very ugly and inconvenient.
Of course I can declare in my class a pointer to the omni_condition
and do the "new"
in constructor and "delete" in the destructor, but this is again is
very inconvenient.
2. Another reason is explained here
http://www.fmi.uni-konstanz.de/~kuehl/c++-faq/exceptions.html#faq-17.3
Finally if a destructor is throwing an exception the only way to avoid
sudden crash
of your application is to write a code in a way (something like the one
shown below),
which nobody is normally using.
So instead of writing something like:
{
omni_condition cond;
...
}
One has to write:
{
omni_condition * cond = new omni_condition;
...
try
{
delete cond;
}
catch(omni_thread_fatal)
{
}
}
How many of the omniORB users are doing something like this in their code?
More information about the omniORB-list
mailing list