cudaError_t cudaStreamWaitEvent ( cudaStream_t  stream,
cudaEvent_t  event,
unsigned int  flags 

Makes all future work submitted to stream wait until event reports completion before beginning execution. This synchronization will be performed efficiently on the device.

The stream stream will wait only for the completion of the most recent host call to cudaEventRecord() on event. Once this call has returned, any functions (including cudaEventRecord() and cudaEventDestroy()) may be called on event again, and the subsequent calls will not have any effect on stream.

If stream is NULL, any future work submitted in any stream will wait for event to complete before beginning execution. This effectively creates a barrier for all future work submitted to the device on this thread.

If cudaEventRecord() has not been called on event, this call acts as if the record has already completed, and so is a functional no-op.

stream - Stream to wait
event - Event to wait on
flags - Parameters for the operation (must be 0)
cudaSuccess, cudaErrorInvalidResourceHandle
Note that this function may also return error codes from previous, asynchronous launches.
See also:
cudaStreamCreate, cudaStreamQuery, cudaStreamSynchronize, cudaStreamDestroy

Generated by Doxygen for NVIDIA CUDA Library  NVIDIA