Added -pthread compiler flag for Unix builds and changed -lpthread to -pthread.