| 204 | } |
| 205 | |
| 206 | void |
| 207 | putKernel(struct KernelCache *kcache, Kernel *kern) |
| 208 | { |
| 209 | KernelNode *knode; |
| 210 | unsigned long refcnt; |
| 211 | |
| 212 | if (kern == NULL) { |
| 213 | return; |
| 214 | } |
| 215 | |
| 216 | knode = container_of(kern, kern, KernelNode); |
| 217 | assert(knode->magic == KNODE_MAGIC); |
| 218 | |
| 219 | if (kcache) { |
| 220 | KCACHE_LOCK(kcache); |
| 221 | } |
| 222 | refcnt = --knode->refcnt; |
| 223 | if (kcache) { |
| 224 | KCACHE_UNLOCK(kcache); |
| 225 | } |
| 226 | |
| 227 | if (!refcnt) { |
| 228 | if (kern->dtor) { |
| 229 | kern->dtor(kern); |
| 230 | } |
| 231 | clReleaseProgram(kern->program); |
| 232 | clReleaseContext(knode->key.context); |
| 233 | free(knode); |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | struct KernelCache |
| 238 | *createKernelCache( |
no outgoing calls
no test coverage detected