QThread::setPriority() Warn about invalid parameter on all platforms
InheritPriority may not be set, but the warning only occurs on Windows. Move the warning to the public class. Change-Id: I51d401300f840e4c1396c2c30182e49ed45d60d2 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
e44de91a2c
commit
be8c257da9
@ -614,7 +614,7 @@ void QThread::run()
|
|||||||
priority.
|
priority.
|
||||||
|
|
||||||
The \a priority argument can be any value in the \c
|
The \a priority argument can be any value in the \c
|
||||||
QThread::Priority enum except for \c InheritPriorty.
|
QThread::Priority enum except for \c InheritPriority.
|
||||||
|
|
||||||
The effect of the \a priority parameter is dependent on the
|
The effect of the \a priority parameter is dependent on the
|
||||||
operating system's scheduling policy. In particular, the \a priority
|
operating system's scheduling policy. In particular, the \a priority
|
||||||
@ -626,6 +626,10 @@ void QThread::run()
|
|||||||
*/
|
*/
|
||||||
void QThread::setPriority(Priority priority)
|
void QThread::setPriority(Priority priority)
|
||||||
{
|
{
|
||||||
|
if (priority == QThread::InheritPriority) {
|
||||||
|
qWarning("QThread::setPriority: Argument cannot be InheritPriority");
|
||||||
|
return;
|
||||||
|
}
|
||||||
Q_D(QThread);
|
Q_D(QThread);
|
||||||
QMutexLocker locker(&d->mutex);
|
QMutexLocker locker(&d->mutex);
|
||||||
if (!d->running) {
|
if (!d->running) {
|
||||||
|
@ -715,9 +715,7 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority)
|
|||||||
prio = THREAD_PRIORITY_TIME_CRITICAL;
|
prio = THREAD_PRIORITY_TIME_CRITICAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QThread::InheritPriority:
|
|
||||||
default:
|
default:
|
||||||
qWarning("QThread::setPriority: Argument cannot be InheritPriority");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user