Fix another race condition.

If EVENT_FINISH is received, but coreState is still CORE_RUNNING and the
thread is still enabled, it would hang.  Makes more sense to wait for
events before processing them anyhow...
Unlock reslts before scheduling.

To prevent deadlock while debugging with events all running sync.
Fix IsOnSeparateCPUThread(), was always false.

Erp, because of detach().
Fix hang on stop before run w/ multithreading.

And clarify logic.
Merge pull request #5987 from unknownbrackets/multithread

Fix another race in multithread, and ge sync