Added support for MinGW. Requires GCC 4.8+ with posix threads.