Skip to content

Commit

Permalink
Merge pull request opencv#2448 from akarsakov:ocl_cxt_termination
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Pavlenko authored and OpenCV Buildbot committed Mar 11, 2014
2 parents 1f8df38 + 806e924 commit 0084dee
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions modules/ocl/src/cl_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,16 @@ class ContextImpl : public Context
CV_Assert(this != currentContext);

#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
if (deviceInfoImpl._id < 0) // not in the global registry, so we should cleanup it
Expand All @@ -617,7 +624,7 @@ class ContextImpl : public Context

#ifdef WIN32
// 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)
#endif
{
Expand Down

0 comments on commit 0084dee

Please sign in to comment.