c:c_threads:troubleshooting:program_crashes:not_handling_exceptions_in_background_threads
Differences
This shows you the differences between two versions of the page.
c:c_threads:troubleshooting:program_crashes:not_handling_exceptions_in_background_threads [2021/06/09 11:16] – created peter | c:c_threads:troubleshooting:program_crashes:not_handling_exceptions_in_background_threads [2021/06/09 11:17] (current) – peter | ||
---|---|---|---|
Line 60: | Line 60: | ||
<code cpp> | <code cpp> | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | static std:: | ||
+ | |||
+ | void HelloWorld() | ||
+ | { | ||
+ | try | ||
+ | { | ||
+ | std:: | ||
+ | throw std:: | ||
+ | } | ||
+ | catch (...) | ||
+ | { | ||
+ | // Set the global exception pointer in case of an exception. | ||
+ | globalExceptionPtr = std:: | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | int main() | ||
+ | { | ||
+ | std::thread t1(HelloWorld); | ||
+ | t1.join(); | ||
+ | if (globalExceptionPtr) | ||
+ | { | ||
+ | try | ||
+ | { | ||
+ | std:: | ||
+ | } | ||
+ | catch (const std:: | ||
+ | { | ||
+ | std::cout << " | ||
+ | } | ||
+ | } | ||
+ | return 0; | ||
+ | } | ||
</ | </ | ||
c/c_threads/troubleshooting/program_crashes/not_handling_exceptions_in_background_threads.1623237390.txt.gz · Last modified: 2021/06/09 11:16 by peter