#include <tbb_exception.h>
Inheritance diagram for tbb::tbb_exception:
Public Member Functions | |
virtual tbb_exception * | move ()=0 throw () |
Creates and returns pointer to the deep copy of this exception object. | |
virtual void | destroy ()=0 throw () |
Destroys objects created by the move() method. | |
virtual void | throw_self ()=0 |
Throws this exception object. | |
virtual const char * | name () const =0 throw () |
Returns RTTI name of the originally intercepted exception. | |
virtual const char * | what () const =0 throw () |
Returns the result of originally intercepted exception's what() method. | |
void | operator delete (void *p) |
If an unhandled exception of the type derived from tbb::tbb_exception is intercepted by the TBB scheduler in one of the worker threads, it is delivered to and re-thrown in the root thread. The root thread is the thread that has started the outermost algorithm or root task sharing the same task_group_context with the guilty algorithm/task (the one that threw the exception first).
Note: when documentation mentions workers with respect to exception handling, masters are implied as well, because they are completely equivalent in this context. Consequently a root thread can be master or worker thread.
NOTE: In case of nested algorithms or complex task hierarchies when the nested levels share (explicitly or by means of implicit inheritance) the task group context of the outermost level, the exception may be (re-)thrown multiple times (ultimately - in each worker on each nesting level) before reaching the root thread at the outermost level. IMPORTANT: if you intercept an exception derived from this class on a nested level, you must re-throw it in the catch block by means of the "throw;" operator.
TBB provides two implementations of this interface: tbb::captured_exception and template class tbb::movable_exception. See their declarations for more info.
virtual void tbb::tbb_exception::destroy | ( | ) | throw () [pure virtual] |
Destroys objects created by the move() method.
Frees memory and calls destructor for this exception object. Can and must be used only on objects created by the move method.
Implemented in tbb::captured_exception, and tbb::movable_exception< ExceptionData >.
virtual tbb_exception* tbb::tbb_exception::move | ( | ) | throw () [pure virtual] |
Creates and returns pointer to the deep copy of this exception object.
Move semantics is allowed.
Implemented in tbb::captured_exception, and tbb::movable_exception< ExceptionData >.
void tbb::tbb_exception::operator delete | ( | void * | p | ) | [inline] |
Operator delete is provided only to allow using existing smart pointers with TBB exception objects obtained as the result of applying move() operation on an exception thrown out of TBB scheduler.
When overriding method move() make sure to override operator delete as well if memory is allocated not by TBB's scalable allocator.
virtual void tbb::tbb_exception::throw_self | ( | ) | [pure virtual] |
Throws this exception object.
Make sure that if you have several levels of derivation from this interface you implement or override this method on the most derived level. The implementation is as simple as "throw *this;". Failure to do this will result in exception of a base class type being thrown.
Implemented in tbb::captured_exception, and tbb::movable_exception< ExceptionData >.