mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Thread priority to string
This commit is contained in:
@@ -37,4 +37,28 @@ namespace BlackMisc
|
||||
if (!QCoreApplication::instance()->thread()) { return false; }
|
||||
return (QCoreApplication::instance()->thread() == QThread::currentThread());
|
||||
}
|
||||
|
||||
const QString &CThreadUtils::priorityToString(QThread::Priority priority)
|
||||
{
|
||||
static const QString idle("idle");
|
||||
static const QString lowest("lowest");
|
||||
static const QString low("low");
|
||||
static const QString normal("normal");
|
||||
static const QString high("high");
|
||||
static const QString highest("highest");
|
||||
|
||||
switch (priority)
|
||||
{
|
||||
case QThread::IdlePriority: return idle;
|
||||
case QThread::LowestPriority: return lowest;
|
||||
case QThread::LowPriority: return low;
|
||||
case QThread::NormalPriority: return normal;
|
||||
case QThread::HighPriority: return high;
|
||||
case QThread::HighestPriority: return highest;
|
||||
default: break;
|
||||
}
|
||||
|
||||
static const QString unknown("unknown");
|
||||
return unknown;
|
||||
}
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user