Massive changes for separate thread state management.
All per-thread globals are moved into a struct which is manipulated
separately.
15 files changed