SWDEV-400448 - SWDEV-392872 - Optimize to add lock only if its null stream

Change-Id: Ia905109a295614e8ce4e2bd24261c86ba8138178
This commit is contained in:
Satyanvesh Dittakavi
2024-02-06 08:09:21 +00:00
parent 24e1c34320
commit a6841e3f43
+5 -5
View File
@@ -31,11 +31,11 @@ namespace hip {
// ================================================================================================
hip::Stream* Device::NullStream(bool wait) {
{
amd::ScopedLock lock(lock_);
if (null_stream_ == nullptr) {
null_stream_ = new Stream(this, Stream::Priority::Normal, 0, true);
}
if (null_stream_ == nullptr) {
amd::ScopedLock lock(lock_);
if (null_stream_ == nullptr) {
null_stream_ = new Stream(this, Stream::Priority::Normal, 0, true);
}
}
if (null_stream_ == nullptr) {
return nullptr;