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

Fixes mingw-w64 build.

This commit is licensed under MIT/X11.