Fix getting/setting thread priority on Windows
commitdca05442112c38b39680d89dd7ba5152191306ac
authorNiklas Therning <niklas@therning.org>
Wed, 10 Aug 2016 14:47:33 +0000 (10 16:47 +0200)
committerNiklas Therning <niklas@therning.org>
Wed, 10 Aug 2016 14:47:33 +0000 (10 16:47 +0200)
tree7e2bbb8f4fb5628328c6a041704292ffc5d7c857
parentc4f45178288cc6b691f639e6c6a21bf1e63bdc78
Fix getting/setting thread priority on Windows

The mono_threads_platform_get_priority()/mono_threads_platform_set_priority()
functions in mono-threads-windows.c assume the "handle" member has been set in
the MonoThreadInfo struct passed to it but it's always NULL. This patch
implements mono_threads_suspend_register() in the same file which sets the
"handle" member at thread registration time, like it's done in
mono-threads-posix.c.

This patch also makes sure the priority of a new thread is set as expected
when the Thread.Priority property has been changed prior to the thread being
started.

Also added a test method to mono/tests/priority.cs which tests that the
priority of the main thread is Normal by default and that it can be changed as
expected.

The changes in this patch fixes the failures in mono/tests/priority.exe on
Windows i386 and x64.
mono/tests/priority.cs
mono/utils/mono-threads-windows.c