Add a new "spinning" thread event type and add state events for when a thread spins on a
lock.  The thread transitions back to running when it stops spinning.
Adjust state handling and try to fix "swapped".

- Prefer TDI_LOCK to TDI_SLEEPING (not sure this matters, but in theory you can block on
  a lock while checking signal state during the process of going to sleep).
- TDI_SWAPPED is only set after a thread is already asleep, so mi_switch() will never
  see it.  Instead, explicitly add state events for when a thread is swapped out/in.