What is the “currently-handled exception” in a multi-threaded program?
14.4 [except.handle]

Created on 2010-11-12.00:00:00 last changed 96 months ago


Date: 2011-03-15.00:00:00

[Voted into the WP at the March, 2011 meeting.]

Date: 2011-01-15.00:00:00

Proposed resolution (January, 2011):

  1. Change Clause 14 [except] paragraph 1 as follows:

  2. Exception handling provides a way of transferring control and information from a point in the execution of a program thread to an exception handler associated with a point previously passed by the execution...
  3. Change 14.2 [except.throw] paragraph 4 as follows:

  4. ...The implementation may then deallocate the memory for the exception object; any such deallocation is done in an unspecified way. [Note: An exception thrown by a throw-expression does not propagate to other threads unless caught, stored, and rethrown using appropriate library functions; see 17.9.7 [propagation] and 32.9 [futures]. —end note]
  5. Change 14.4 [except.handle] paragraph 6 as follows:

  6. If no match is found among the handlers for a try block, the search for a matching handler continues in a dynamically surrounding try block of the same thread.
Date: 2010-11-12.00:00:00
N3092 comment CA 5

14.4 [except.handle] paragraph 8 defines the “currently handled exception” as

The exception with the most recently activated handler that is still active

This definition ignores the possibility that an exception might be thrown and caught in another thread during the execution of a handler. Since throw; rethrows the “currently handled exception,” one might conclude that it would be the other thread's exception that would be rethrown instead of the one that activated that handler.

Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3406
2011-04-10 00:00:00adminsetstatus: tentatively ready -> fdis
2011-02-28 00:00:00adminsetstatus: review -> tentatively ready
2010-11-29 00:00:00adminsetmessages: + msg3114
2010-11-12 00:00:00admincreate