Don't include pthread.h when it's not needed.

Fixes mingw-w64 build.

This commit is licensed under MIT/X11.
Merge pull request #694 from madewokherd/pthreadinclude

Don't include pthread.h when it's not needed.