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:
parent
4e9944e6c8
commit
60113056bc
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user