##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::set_terminate

From cppreference.com
< cpp‎ | error

Defined in header `<exception>` |  |
std::terminate_handler set_terminate( std::terminate_handler f ) |  |

Makes `f` the new global terminate handler function and returns the previously installed std::terminate_handler.

This function is thread-safe. Every call to `std::set_terminate` synchronizes-with (see std::memory_order) the subsequent `std::set_terminate` and std::get_terminate | (since C++11)

### [edit] Parameters

f | - | pointer to function of type std::terminate_handler, or null pointer

### [edit] Return value

The previously-installed terminate handler, or a null pointer value if none was installed.

### [edit] Exceptions

(none) | (until C++11)
`noexcept` specification: noexcept | (since C++11)

### [edit] See also

terminate | function called when exception handling fails (function) [edit]
get_terminate (C++11) | obtains the current terminate_handler (function) [edit]
terminate_handler | the type of the function called by std::terminate (typedef) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/error/set_terminate&oldid=72153"
Category:

- unconditionally noexcept