Public Member Functions | List of all members
tbb::tbb_exception Class Referenceabstract

Interface to be implemented by all exceptions TBB recognizes and propagates across the threads. More...

#include <tbb_exception.h>

Inheritance diagram for tbb::tbb_exception:
tbb::captured_exception tbb::movable_exception< ExceptionData >

Public Member Functions

virtual tbb_exceptionmove ()=0 throw ()
 Creates and returns pointer to the deep copy of this exception object. More...
 
virtual void destroy ()=0 throw ()
 Destroys objects created by the move() method. More...
 
virtual void throw_self ()=0
 Throws this exception object. More...
 
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)
 

Detailed Description

Interface to be implemented by all exceptions TBB recognizes and propagates across the threads.

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.

Member Function Documentation

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::movable_exception< ExceptionData >, and tbb::captured_exception.

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::movable_exception< ExceptionData >, and tbb::captured_exception.

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::movable_exception< ExceptionData >, and tbb::captured_exception.


The documentation for this class was generated from the following file:

Copyright © 2005-2014 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.