implement thread module