mirror of
https://github.com/opencv/opencv.git
synced 2024-12-02 16:00:17 +08:00
Merge pull request #1972 from alalek:ocl_queue_cleanup_hung
This commit is contained in:
commit
b5cdc03b81
@ -1931,6 +1931,10 @@ struct Queue::Impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
~Impl()
|
~Impl()
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (!cv::__termination)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if(handle)
|
if(handle)
|
||||||
{
|
{
|
||||||
@ -1938,6 +1942,7 @@ struct Queue::Impl
|
|||||||
clReleaseCommandQueue(handle);
|
clReleaseCommandQueue(handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IMPLEMENT_REFCOUNTABLE();
|
IMPLEMENT_REFCOUNTABLE();
|
||||||
|
|
||||||
|
@ -249,6 +249,9 @@ namespace ocl
|
|||||||
MatAllocator* getOpenCLAllocator();
|
MatAllocator* getOpenCLAllocator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern bool __termination; // skip some cleanups, because process is terminating
|
||||||
|
// (for example, if ExitProcess() was already called)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /*_CXCORE_INTERNAL_H_*/
|
#endif /*_CXCORE_INTERNAL_H_*/
|
||||||
|
@ -734,18 +734,23 @@ cvErrorFromIppStatus( int status )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace cv {
|
||||||
|
bool __termination = false;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE
|
#if defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE
|
||||||
#ifdef HAVE_WINRT
|
#ifdef HAVE_WINRT
|
||||||
#pragma warning(disable:4447) // Disable warning 'main' signature found without threading model
|
#pragma warning(disable:4447) // Disable warning 'main' signature found without threading model
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID );
|
BOOL WINAPI DllMain( HINSTANCE, DWORD, LPVOID );
|
||||||
|
|
||||||
BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID )
|
BOOL WINAPI DllMain( HINSTANCE, DWORD fdwReason, LPVOID lpReserved )
|
||||||
{
|
{
|
||||||
if( fdwReason == DLL_THREAD_DETACH || fdwReason == DLL_PROCESS_DETACH )
|
if( fdwReason == DLL_THREAD_DETACH || fdwReason == DLL_PROCESS_DETACH )
|
||||||
{
|
{
|
||||||
|
if (lpReserved != NULL) // called after ExitProcess() call
|
||||||
|
cv::__termination = true;
|
||||||
cv::deleteThreadAllocData();
|
cv::deleteThreadAllocData();
|
||||||
cv::deleteThreadData();
|
cv::deleteThreadData();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user