Added -lpthread for older g++ support