Merge branch 'msw-thread-priority'

Fix wxThread::SetPriority() documentation and avoid a spurious error
message.

Closes https://github.com/wxWidgets/wxWidgets/pull/1683
This commit is contained in:
Vadim Zeitlin
2019-12-28 00:06:40 +01:00
3 changed files with 8 additions and 8 deletions

View File

@@ -559,9 +559,6 @@ public:
// priority
// Sets the priority to "prio" which must be in 0..100 range (see
// also wxPRIORITY_XXX constants).
//
// NB: under MSW the priority can only be set after the thread is
// created (but possibly before it is launched)
void SetPriority(unsigned int prio);
// Get the current priority.

View File

@@ -1267,11 +1267,6 @@ public:
- @c wxPRIORITY_DEFAULT: 50
- @c wxPRIORITY_MAX: 100
Notice that in the MSW implementation the thread priority can currently
be only set after creating the thread with CreateThread(). But under
all platforms this method can be called either before launching the
thread using Run() or after doing it.
Please note that currently this function is not implemented when using
the default (@c SCHED_OTHER) scheduling policy under POSIX systems.
*/

View File

@@ -606,6 +606,14 @@ void wxThreadInternal::SetPriority(unsigned int priority)
{
m_priority = priority;
if ( !m_hThread )
{
// The thread hasn't been created yet, so calling SetThreadPriority()
// right now would just result in an error -- just skip doing this, as
// the priority will be set when Create() is called later.
return;
}
// translate wxWidgets priority to the Windows one
int win_priority;
if (m_priority <= 20)