Add -pthread compiler and linker flag