Make __iv_invalidate_now() an inline function.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Add test/timer_past, a test to verify timers set to expire in the past.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
iv_timer: Implement fairness for timers.

Previously, registering a timer with an expiration time in the past
from another timer handler would cause that timer's handler to be run
without checking for pending tasks or polling file descriptors or
handles.  If a timer repeatedly re-registers itself from its own
handler with an expiration time in the past, this would cause an
infinite loop.

After this patch, if a timer is registered with an expiration time in
the past, put it on a special list of expired timers which is checked
only once per poll cycle.  If the timer is registered from a timer
handler, this means that its handler will only be run in the next poll
cycle.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Add test/timer_fairness, a test to verify timer fairness.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>