Add a function to query if global OpenCL context is initialized.

This commit is contained in:
peng xiao
2013-06-13 10:46:12 +08:00
parent 98f6a4a615
commit 5fd724b54a
2 changed files with 12 additions and 1 deletions

View File

@@ -917,6 +917,14 @@ namespace cv
int Context::val = 0;
static Mutex cs;
static volatile int context_tear_down = 0;
bool initialized()
{
return *((volatile int*)&Context::val) != 0 &&
Context::clCxt->impl->clCmdQueue != NULL&&
Context::clCxt->impl->oclcontext != NULL;
}
Context* Context::getContext()
{
if(*((volatile int*)&val) != 1)