diff options
-rw-r--r-- | desktop/source/app/opencl.cxx | 1 | ||||
-rw-r--r-- | include/opencl/OpenCLZone.hxx | 9 | ||||
-rw-r--r-- | opencl/source/OpenCLZone.cxx | 6 | ||||
-rw-r--r-- | vcl/source/app/svmain.cxx | 8 |
4 files changed, 24 insertions, 0 deletions
diff --git a/desktop/source/app/opencl.cxx b/desktop/source/app/opencl.cxx index 7eb83392f9f7..20bb981517fe 100644 --- a/desktop/source/app/opencl.cxx +++ b/desktop/source/app/opencl.cxx @@ -125,6 +125,7 @@ void Desktop::CheckOpenCLCompute(const Reference< XDesktop2 > &xDesktop) SAL_INFO("opencl", "Initiating test of OpenCL device"); OpenCLZone aZone; + OpenCLZone::enterInitialTest(); OUString aDevice = officecfg::Office::Calc::Formula::Calculation::OpenCLDevice::get(); OUString aSelectedCLDeviceVersionID; diff --git a/include/opencl/OpenCLZone.hxx b/include/opencl/OpenCLZone.hxx index eca530a7a5ba..0d2059dddc87 100644 --- a/include/opencl/OpenCLZone.hxx +++ b/include/opencl/OpenCLZone.hxx @@ -19,6 +19,7 @@ class OPENCL_DLLPUBLIC OpenCLZone static volatile sal_uInt64 gnEnterCount; /// how many times have we left a new CL zone static volatile sal_uInt64 gnLeaveCount; + static volatile bool gbInInitialTest; public: OpenCLZone() @@ -29,6 +30,8 @@ public: ~OpenCLZone() { gnLeaveCount++; + if (!isInZone()) + gbInInitialTest = false; } static bool isInZone() @@ -36,7 +39,13 @@ public: return gnEnterCount != gnLeaveCount; } + static bool isInInitialTest() + { + return gbInInitialTest; + } + static void hardDisable(); + static void enterInitialTest(); }; #endif // INCLUDED_OPENCL_INC_OPENCL_ZONE_HXX diff --git a/opencl/source/OpenCLZone.cxx b/opencl/source/OpenCLZone.cxx index 03521a29c66f..52d6ada8518a 100644 --- a/opencl/source/OpenCLZone.cxx +++ b/opencl/source/OpenCLZone.cxx @@ -21,6 +21,7 @@ sal_uInt64 volatile OpenCLZone::gnEnterCount = 0; sal_uInt64 volatile OpenCLZone::gnLeaveCount = 0; +bool volatile OpenCLZone::gbInInitialTest = false; /** * Called from a signal handler if we get @@ -47,4 +48,9 @@ void OpenCLZone::hardDisable() } } +void OpenCLZone::enterInitialTest() +{ + gbInInitialTest = true; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index aba97b58482a..4984ff439b98 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -24,6 +24,8 @@ #include <osl/file.hxx> #include <osl/signal.h> +#include <desktop/exithelper.h> + #include <tools/debug.hxx> #include <tools/resmgr.hxx> @@ -123,7 +125,13 @@ oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo #endif #if HAVE_FEATURE_OPENCL if (OpenCLZone::isInZone()) + { OpenCLZone::hardDisable(); +#ifdef _WIN32 + if (OpenCLZone::isInInitialTest()) + TerminateProcess(GetCurrentProcess(), EXITHELPER_NORMAL_RESTART); +#endif + } #endif } |