/** * @return #hipSuccess, #hipErrorInvalidResourceHandle */ hipError_t hipStreamDestroy(hipStream_t stream) { HIP_INIT_API(hipStreamDestroy, stream); hipError_t e = hipSuccess; //--- Drain the stream: if (stream == NULL) { if (!HIP_FORCE_NULL_STREAM) { e = hipErrorInvalidResourceHandle; } } else { stream->locked_wait(); ihipCtx_t* ctx = stream->getCtx(); if (ctx) { ctx->locked_removeStream(stream); delete stream; } else { e = hipErrorInvalidResourceHandle; } } return ihipLogStatus(e); }