RIOT-OS/RIOT — pull request #1939 by Kijewski (2014-11-04 20:42:59+00:00)
Title: core: introduce thread_priority_t, enhance `sched_switch()`

This PR introduces `thread_priority_t`, an integer typedef to denote a
thread priority. It also introduces the convenience functions
`thread_priority_less()`, which returns the higher of two prioties, and
`thread_priority_valid()` which tests if a given priority a valid
priority for user threads (e.g. PRIORITY_IDLE is not).

`sched_switch()` now yields if either the other priority is higher than
the current priority, or if the current thread is not on the runqueue.

Fixes #1935, and a few bugs I found in sched.c, which did not build
with `#define DEBUG 1`, and a minor bug in `semaphore.c`.