Waits on the host thread for commands identified by event objects in events to complete. A command is considered complete if its execution status is CL_COMPLETE or a negative value. The events specified in event_list act as synchronization points.
If the cl_khr_gl_event extension is enabled, event objects can also be used to reflect the status of an OpenGL sync object. The sync object in turn refers to a fence command executing in an OpenGL command stream. This provides another method of coordinating sharing of buffers and images between OpenGL and OpenCL.