Thread monitoring with restart added.