Rewrite scheduler functions getting and setting process and thread priority

So far the scheduler priority handling is not POSIX compatible.
The priorities use a range of -14 up to +15, which means it's not clear
if the POSIX-required return value of -1 in case of an error is *really*
an error or just the valid priority value -1.  Even more confusing, -14
is the *max* value and 15 is the *min* value.  Last but not least this
range doesn't match the POSIX requirement of at least 32 priority values.

This patch cleans up scheduler priority handling and moves the valid
priority range to 1 (min) - 32 (max).  It also adds a function
sched_get_thread_priority() which will help to make thread priority
more POSIX-like.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2016-05-20 17:38:22 +02:00
parent 6ac6e7c2bd
commit 450f557fee
2 changed files with 172 additions and 171 deletions

View File

@ -36,7 +36,7 @@ details. */
extern "C" void __fp_lock_all ();
extern "C" void __fp_unlock_all ();
extern "C" int valid_sched_parameters(const struct sched_param *);
extern "C" bool valid_sched_parameters(const struct sched_param *);
extern "C" int sched_set_thread_priority(HANDLE thread, int priority);
static inline verifyable_object_state
verifyable_object_isvalid (void const * objectptr, thread_magic_t magic,