// this project was created using VS 2008 C++ win32 console application, with pre-compiled header checked.
this was happening with _JUST_THREAD_DEADLOCK_CHECK being defined in the _preprocessor in properties
I was trying to run the test to verify it was installed and working.
the output of this has been the following:
"hello from the main thread"
nothing else. either the thread is being deadlocked or something is happening that I am not aware of.
// Parallel_1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <thread>
#include <mutex>
std::mutex io_mutex;
void greeting(const char* message)
{
std::lock_guard<std::mutex> lk(io_mutex);
std::cout << message << std::endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
std::thread t( greeting, "hello from another thread" );
greeting("hello from the main thread");
t.join(); //<-- this is where an error is occuring
return 0;
}
here is the call stack:
> msvcr90d.dll!_NMSG_WRITE(int rterrnum=10) Line 198 C
msvcr90d.dll!abort() Line 59 + 0x7 bytes C
msvcr90d.dll!terminate() Line 130 C++
Parallel.exe!__jss::stack_trace::build_trace_from() + 0x40 bytes
Parallel.exe!__jss::stack_trace::stack_trace() + 0x42 bytes
Parallel.exe!__jss::mutex::lock() + 0x2e bytes
Parallel.exe!std::unique_lock<std::mutex>::unique_lock<std::mutex>(std::mutex & m_={...}) Line 261 C++
Parallel.exe!CLock::CLock(std::mutex & _m={...}) Line 19 + 0xf bytes C++
Parallel.exe!greeting(const char * message=0x010daab0) Line 16 + 0xd bytes C++
Parallel.exe!__jss::__invoke1<void,void (__cdecl*)(char const *),char const *>::operator()(void (const char *)* & __func=0x010c177b, const char * & __a1=0x010daab0) Line 15 + 0xf bytes C++
Parallel.exe!__jss::__invoker1<void,void (__cdecl*)(char const *),char const *>::operator()() Line 79 C++
Parallel.exe!__jss::thread_data<__jss::__invoker1<void,void (__cdecl*)(char const *),char const *> >::run() Line 94 C++
Parallel.exe!std::`anonymous namespace'::thread_start_function() + 0x50 bytes
msvcr90d.dll!_callthreadstartex() Line 348 + 0xf bytes C
msvcr90d.dll!_threadstartex(void * ptd=0x000e53e0) Line 331 C
kernel32.dll!7566e3f3()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!7708cfed()
ntdll.dll!7708d1ff()