Less logging; make a few locks less agressive.
Use error-checking mutexes; log time as well as msg.
Add more writes to ensure flush() doesn't hang.