Optimize cond var notification

Notification of a conditional variable shouldn't be under the locked
mutex, as it may affect extra mutex contentions.

Pick-to: 6.5 6.6
Change-Id: Ie8429eca3f36e9a6e8e5ad2e0337bbf508f5b326
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Artem Dyomin 2023-09-12 14:46:30 +02:00
parent 4e9944e6c8
commit 60113056bc

View File

@ -400,8 +400,10 @@ void QSemaphore::release(int n)
return; return;
} }
{
const auto locker = qt_scoped_lock(d->mutex); const auto locker = qt_scoped_lock(d->mutex);
d->avail += n; d->avail += n;
}
d->cond.notify_all(); d->cond.notify_all();
} }