add watchdog thread to detect lockups