Compile with -lpthread