Add -lpthread to make compile pass