Improve separate CPU thread performance, fix condition variable misuse

I had thought I'd committed this, but I guess I didn't.  On x64, treating the values as atomic should be safe enough, and is much faster of course.

Also fixes not locking around a cond var wait.  Oops.

-[Unknown]