+void wxThreadInternal::SetPriority(
+ unsigned int nPriority
+)
+{
+ // translate wxWindows priority to the PM one
+ ULONG ulOS2_PriorityClass;
+ ULONG ulOS2_SubPriority;
+ ULONG ulrc;
+
+ m_nPriority = nPriority;
+ if (m_nPriority <= 25)
+ ulOS2_PriorityClass = PRTYC_IDLETIME;
+ else if (m_nPriority <= 50)
+ ulOS2_PriorityClass = PRTYC_REGULAR;
+ else if (m_nPriority <= 75)
+ ulOS2_PriorityClass = PRTYC_TIMECRITICAL;
+ else if (m_nPriority <= 100)
+ ulOS2_PriorityClass = PRTYC_FOREGROUNDSERVER;
+ else
+ {
+ wxFAIL_MSG(wxT("invalid value of thread priority parameter"));
+ ulOS2_PriorityClass = PRTYC_REGULAR;
+ }
+ ulOS2_SubPriority = (ULONG) (((m_nPriority - 1) % 25 + 1) * 31.0 / 25);
+ ulrc = ::DosSetPriority( PRTYS_THREAD
+ ,ulOS2_PriorityClass
+ ,ulOS2_SubPriority
+ ,(ULONG)m_hThread
+ );
+ if (ulrc != 0)
+ {
+ wxLogSysError(_("Can't set thread priority"));
+ }
+}
+