This code results in lost events and a memory leak.


cl::Event event;
q.enqueueNDRangeKernel(kern1, cl::NullRange, cl::NDRange(a), cl::NullRange, &wait_queue, &event);

wait_queue.clear();...