\r
#include "../stdafx.h"\r
\r
+#include <boost/thread.hpp>\r
+\r
#include "win32_exception.h"\r
\r
#include "../log/log.h"\r
+#include "../concurrency/executor.h"\r
\r
namespace caspar {\r
\r
+bool& installed_for_thread()\r
+{\r
+ static boost::thread_specific_ptr<bool> installed;\r
+\r
+ auto for_thread = installed.get();\r
+ \r
+ if (!for_thread)\r
+ {\r
+ for_thread = new bool(false);\r
+ installed.reset(for_thread);\r
+ }\r
+\r
+ return *for_thread;\r
+}\r
+\r
void win32_exception::install_handler() \r
{\r
//#ifndef _DEBUG\r
_set_se_translator(win32_exception::Handler);\r
+ installed_for_thread() = true;\r
//#endif\r
}\r
\r
+void win32_exception::ensure_handler_installed_for_thread(\r
+ const char* thread_description)\r
+{\r
+ if (!installed_for_thread())\r
+ {\r
+ install_handler();\r
+\r
+ if (thread_description)\r
+ detail::SetThreadName(GetCurrentThreadId(), thread_description);\r
+ }\r
+}\r
+\r
void win32_exception::Handler(unsigned int errorCode, EXCEPTION_POINTERS* pInfo) {\r
switch(errorCode)\r
{\r