Centralize the thread ready queue logic.

This makes it slower for now, but should make it easier to optimize correctly.
Replace the thread ready queue with non-STL.

It seems much faster.
Dynamically size the thread queue, explicitly alloc.
Fix crash if queue is empty during savestate.

On load it would then crash.
Merge pull request #1200 from unknownbrackets/threadqueue-perf

Improve threadqueue performance