fix linking error with "undefined reference to pthread" on a clean compile

When I tried to compile/link the code on my system I had some errors concerning pthreads. This change worked for me.