don't assume g++ is the compiler
fix the read thread for posix