diff --git a/hipamd/src/hip_device.cpp b/hipamd/src/hip_device.cpp index bcf6830f12..4d18ace5b1 100644 --- a/hipamd/src/hip_device.cpp +++ b/hipamd/src/hip_device.cpp @@ -31,10 +31,12 @@ namespace hip { // ================================================================================================ hip::Stream* Device::NullStream(bool wait) { - if (null_stream_ == nullptr) { - null_stream_ = new Stream(this, Stream::Priority::Normal, 0, true); + { + amd::ScopedLock lock(lock_); + if (null_stream_ == nullptr) { + null_stream_ = new Stream(this, Stream::Priority::Normal, 0, true); + } } - if (null_stream_ == nullptr) { return nullptr; }