It is a bit unclear to me if clWaitForEvents() is thread-safe: can two different threads call clWaitForEvents() on 2 different events related to commands/memory operation on the same queue ?
This is my scenario:
1) under mutex, a command A is submitted to the queue and the OpenCL event associated with A is returned;
2) under mutex, a command B is submitted to the queue and the OpenCL event associated with B is returned;
3) can two different threads call clWaitForEvents(Event returned for A) and clWaitForEvents(Event returned for B) ?
I was unable to find an answer to this question in the OpenCL specification, in particular the appendix A.2 isn't very clear about this point (it talks about queues, memory objects, programs, etc. but not about events).
Any function call which does not modify any object is always thread safe. clWaitForEvents only do checks and does not change any object and hence is thread safe.