thread synchronization and logging