You forgot to join your thread:
t.join();
FYI, there is already a native win32 implementation of std::thread and sync primitives. It is a header-only library and works on any C++11 compliant version of MinGW.https://github.com/meganz/mingw-std-threads