fix thread bug on linux