You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
4.4 KiB

  1. <!DOCTYPE html
  2. PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  3. <!-- saved from url=(0014)about:internet -->
  4. <html xmlns:MSHelp="http://www.microsoft.com/MSHelp/" lang="en-us" xml:lang="en-us"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta name="DC.Type" content="reference">
  6. <meta name="DC.Title" content="Exceptions">
  7. <meta name="DC.subject" content="Exceptions">
  8. <meta name="keywords" content="Exceptions">
  9. <meta name="DC.Relation" scheme="URI" content="../reference/reference.htm">
  10. <meta name="DC.Relation" scheme="URI" content="../reference/exceptions/tbb_exception.htm">
  11. <meta name="DC.Relation" scheme="URI" content="../reference/exceptions/captured_exception.htm">
  12. <meta name="DC.Relation" scheme="URI" content="../reference/exceptions/movable_exception.htm">
  13. <meta name="DC.Relation" scheme="URI" content="../reference/exceptions/specific_exceptions.htm">
  14. <meta name="DC.Format" content="XHTML">
  15. <meta name="DC.Identifier" content="Exceptions">
  16. <meta name="DC.Language" content="en-US">
  17. <link rel="stylesheet" type="text/css" href="../intel_css_styles.css">
  18. <title>Exceptions</title>
  19. </head>
  20. <body id="Exceptions">
  21. <!-- ==============(Start:NavScript)================= -->
  22. <script src="..\NavScript.js" language="JavaScript1.2" type="text/javascript"></script>
  23. <script language="JavaScript1.2" type="text/javascript">WriteNavLink(1);</script>
  24. <!-- ==============(End:NavScript)================= -->
  25. <a name="Exceptions"><!-- --></a>
  26. <h1 class="topictitle1">Exceptions</h1>
  27. <div>
  28. <div class="section"> <p>Intel&reg; Threading Building Blocks (Intel&reg; TBB) propagates exceptions along logical paths in a tree of tasks. Because these paths cross between thread stacks, support for moving an exception between stacks is necessary. </p>
  29. <p>When an exception is thrown out of a task, it is caught inside the Intel&reg; TBB run-time and handled as follows:</p>
  30. <ol class="ol_3">
  31. <li>If the cancellation group for the task has already been cancelled, the exception is ignored.</li>
  32. <li>Otherwise the exception or an approximation of it is captured and the group is cancelled.</li>
  33. <li>The captured exception is rethrown from the root of the cancellation group after all tasks in the group have completed or have been successfully cancelled.</li>
  34. </ol>
  35. <p>The exact exception is captured when both of the following conditions are true:</p>
  36. <ul type="disc" class="ul_4">
  37. <li>The task's <samp class="codeph">task_group_context</samp> was created in a translation unit compiled with <samp class="codeph">TBB_USE_CAPTURED_EXCEPTION=0</samp>. </li>
  38. <li>The Intel&reg; TBB library was built with a compiler that supports the <samp class="codeph">std::exception_ptr</samp> feature of C++11.</li>
  39. </ul>
  40. <p>Otherwise an appoximation of the original exception <em>x</em> is captured as follows:</p>
  41. <ol class="ol_3">
  42. <li>If <samp class="codeph"><samp class="codeph"><em>x</em></samp></samp> is a <samp class="codeph">tbb_exception</samp>, it
  43. is captured by <samp class="codeph"><em>x</em>.move()</samp>.</li>
  44. <li>If <samp class="codeph"><em>x</em></samp> is a <samp class="codeph">std::exception</samp>, it is captured as
  45. a
  46. <samp class="codeph">tbb::captured_exception(typeid(<em>x</em>).name(),<em>x</em>.what())</samp>. </li>
  47. <li>Otherwise <samp class="codeph"><em>x</em></samp> is captured as a <samp class="codeph">tbb::captured</samp>
  48. exception with implementation-specified value for <samp class="codeph">name()</samp> and
  49. <samp class="codeph">what()</samp>.</li>
  50. </ol>
  51. </div>
  52. </div>
  53. <div class="familylinks">
  54. <div class="parentlink"><strong>Parent topic:</strong>&nbsp;<a href="../reference/reference.htm">Intel&reg; Threading Building Blocks Reference Manual</a></div>
  55. </div>
  56. <div>
  57. <ul class="ullinks">
  58. <li class="ulchildlink"><a href="../reference/exceptions/tbb_exception.htm">tbb_exception</a><br>
  59. </li>
  60. <li class="ulchildlink"><a href="../reference/exceptions/captured_exception.htm">captured_exception</a><br>
  61. </li>
  62. <li class="ulchildlink"><a href="../reference/exceptions/movable_exception.htm">movable_exception&lt;ExceptionData&gt;</a><br>
  63. </li>
  64. <li class="ulchildlink"><a href="../reference/exceptions/specific_exceptions.htm">Specific Exceptions</a><br>
  65. </li>
  66. </ul>
  67. </div>
  68. </body>
  69. </html>