I have some classes objects of which I'd like to reuse after the occurrence of some exceptions. My question is regarding exceptions transported from other threads using exception_ptr
. For example, several functions before starting operations (intended to be called by the object's user) do if (_wrkrExc) rethrow_exception(_wrkrExc);
. I want to be able to reuse the object after the exception is thrown (which forces the user to deal with it). Is the exception_ptr
nulled after a rethrow, or does that have to be done manually so the next check point doesn't throw again? If the latter, what would be a good design for handling it? Adding a Clear()
or Reset()
method the user must call before reusing the object seems to me class API bloat, and doing something like the below seems ugly at best:
try
{
if (_wrkrExc) rethrow_exception(_wrkrExc);
}
catch (...)
{
_wrkrExc = nullptr;
throw;
}
Aucun commentaire:
Enregistrer un commentaire