Make file watcher thread-safe + minor cleanup

Signed-off-by: Nico Rutishauser <nr@hotmail.ch>