I have found the bug where the output doesn't match the input. It was my error. The underlying cause was that I assumed the scoped_lock would unlock only when the lock went out of scope, and I thought (well really I wasn't thinking) that the unlock of one mutex and the lock of another would be atomic. So the error was that between the point where the input mutex is unlocked and the executing thread's mutex is locked in ExecuteThread(), the WaitTillDone() thread can sneak in, lock the input mutex and the thread's mutex. So the executing thread is locked out of executing its input. Once I changed the locks to be in the same scope and manually unlocked the input mutex, the problem went away. But the access violations did not go away and are still happening often. Also, can someone tell me how to respond to my own topic, using gmail and digest mode? Sorry for the earlier thread pollution.