lib: Thread scheduler should be fair and not let events starve I/O and timers

* thread.c: (thread_fetch) the current scheduler will service events
  indefinitely, ignoring I/O and timers, so long as there are events.
  In other words, events can crowd out I/O and timers.  In theory this
  shouldn't be a huge problem as events are generated only by timers
  and I/O, however in practice it means normal-load behaviour is not as
  useful a predictor of high-load behaviour as it should be.

  Fix this by considering all the kinds of threads, in every run of the
  scheduler.  For any given run, we prioritise events, however across
  runs the scheduler should be fair.

  This has been observed to give more stable inter-packet times in
  testing of ospfd (i.e.  lower std-dev).

 (thread_process) new heler to queue all the given threads onto the ready
 list
1 file changed