import reg, replace linux thread code, others