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:
Collaboration 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. 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. More...
virtual const char * | what () const __TBB_override=0 throw ()
| Returns the result of originally intercepted exception's what() method. More...
void | operator delete (void *p)

## Private Member Functions

void * | operator new (size_t)

## 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.

Definition at line 137 of file tbb_exception.h.

## Member Function Documentation

## destroy()

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.

## move()

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.

## name()

virtual const char* tbb::tbb_exception::name | ( |  | ) | const
throw | ( |
| ) |  |

pure virtual

Returns RTTI name of the originally intercepted exception.

Implemented in tbb::movable_exception< ExceptionData >, and tbb::captured_exception.

## operator delete()

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.

Definition at line 181 of file tbb_exception.h.

{
internal::deallocate_via_handler_v3(p);
}

References tbb::internal::deallocate_via_handler_v3(), and p.

Here is the call graph for this function:

## operator new()

void* tbb::tbb_exception::operator new | ( | size_t |  | ) |

private

No operator new is provided because the TBB usage model assumes dynamic creation of the TBB exception objects only by means of applying move() operation on an exception thrown out of TBB scheduler.

## throw_self()

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.

## what()

virtual const char* tbb::tbb_exception::what | ( |  | ) | const
throw | ( |
| ) |  |

pure virtual

Returns the result of originally intercepted exception's what() method.

Implemented in tbb::movable_exception< ExceptionData >, and tbb::captured_exception.

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

- tbb_exception.h

tbb::internal::deallocate_via_handler_v3
void __TBB_EXPORTED_FUNC deallocate_via_handler_v3(void *p)
Deallocates memory using FreeHandler.
Definition: cache_aligned_allocator.cpp:232
p
void const char const char int ITT_FORMAT __itt_group_sync p
Definition: ittnotify_static.h:91

Copyright © 2005-2020 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.