When I tried to google information about this, I got a lot of results from people trying to compile bitcoin wallets under Windows :D
Can you post the smallest program you can create that generates the same error reliably? I'd like to try compiling it under Cygwin and see if the same thing happens, then again in Visual Studio Community to see if it happens there too. That would at least narrow the problem down a bit.
and I compile it with G++ -o m m.cpp .\src\Thread.cpp -I include -static-libstdc++ -g -l pthread
and the output I get is
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
TEST
Thread Created
SSSSS
Starting
started
The thread is running...
Try lock returned 0
In tterminate called after throwing an instance of 'hstd::system_errorr'e
ad . what(): .Invalid argument.
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Casted
Thread Started...
Why are you creating your mutexes with new? If you had made it a regular variable (i.e. std::mutex data_lock;) you couldn't have forgotten because it would be initialized automatically. The same could be said about your std::thread object.