Merge pull request #2448 from akarsakov:ocl_cxt_termination

This commit is contained in:
Andrey Pavlenko 2014-03-11 12:57:28 +04:00 committed by OpenCV Buildbot
commit 0084dee05b

View File

@ -596,9 +596,16 @@ protected:
CV_Assert(this != currentContext); CV_Assert(this != currentContext);
#ifdef CL_VERSION_1_2 #ifdef CL_VERSION_1_2
if (supportsFeature(FEATURE_CL_VER_1_2)) #ifdef WIN32
// if process is on termination stage (ExitProcess was called and other threads were terminated)
// then disable device release because it may cause program hang
if (!__termination)
#endif
{ {
openCLSafeCall(clReleaseDevice(clDeviceID)); if (supportsFeature(FEATURE_CL_VER_1_2))
{
openCLSafeCall(clReleaseDevice(clDeviceID));
}
} }
#endif #endif
if (deviceInfoImpl._id < 0) // not in the global registry, so we should cleanup it if (deviceInfoImpl._id < 0) // not in the global registry, so we should cleanup it
@ -617,7 +624,7 @@ protected:
#ifdef WIN32 #ifdef WIN32
// if process is on termination stage (ExitProcess was called and other threads were terminated) // if process is on termination stage (ExitProcess was called and other threads were terminated)
// then disable command queue release because it may cause program hang // then disable context release because it may cause program hang
if (!__termination) if (!__termination)
#endif #endif
{ {