I have a DLL that needs to spawn a new thread when it is loaded. My current approach is something like this:
struct Dummy {Dummy() {} };
Dummy obj;
Dummy::Dummy()
{
std::thread t([]() {std::cout<<"Helloworld\n"; });
assert( t.joinable() );
t.join();
}
Unfortunately, this code hangs forever at the t.join()
line, and it does not print anything. The main application loads the dll with LoadLibrary
.
I am using gcc 4.8 from Mingw.
Aucun commentaire:
Enregistrer un commentaire