Unify ifdef conditions related to threading code

The two different variants of the threadlib basically are
win32 and unix - use _WIN32 to check for this consistently,
instead of occasionally using __GNUC__ to enable the unix
codepath. (__GNUC__ is also defined on mingw, which still is
a windows platform and should use the _WIN32 code.)
Merge pull request #392 from mstorsjo/unify-threading-ifdefs

Unify ifdef conditions related to threading code