fixed a mutex lock problem when forking into background, tightened up safety of thread interruption / shutdown, fixed compilation error on gcc47