add thread and mutex