How do I check the reference counter of things in openCL?

832 Views Asked by At

http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/

I don't understand how to check the reference count for say, an openCL context. How is it done? Is there a function call or field? I tried googling and I couldn't figure it out. I tried debugging and inspecting (using JOCL and Java) and I didn't see anything. Let me know.

2

There are 2 best solutions below

0
On

Take a look clRetain*/clRelease* functions. I guess you were downvoted because they can be found very easily. It wasn't me though.

1
On

You're not really supposed to read the reference counts, because the information would be meaningless. By the time the (hypothetical clReadReferenceCount_NOT_REAL) function returns and you'd get the reference count value, other threads may have incremented and/or decremented the reference count. The only way you're supposed to access the reference count is through glRetain*/clRelease* -functions, which are used for incrementing and decrementing only (not reading the value), like a semaphore in concurrent programming.