lundi 5 novembre 2018

Creating thread in SetUp makes application to crash

I am working on adding some unittests to my application: As it is multhreading application I have added thread creation in SetUp method But this is making app to crash. Could someone to tell me where the crash is?

void TestFixture::SetUp()
{
   std::cerr << "TestFixture::SetUp" << std::endl;
   serverThreadM = std::thread(
       [this]{ std::cout << "hello " << 
       std::endl; });
}

void TestFixture::TearDown()
{
   std::cerr << "ConnectionPoolFixture::TearDown" << std::endl;
   serverThreadM.join();
}

serverThreadM is an std::thread. Member of TestFixture class

So far the test I have created is: TEST_F(TestFixture, basic_basic_test) { ASSERT_EQ(1,1); }

Thanks

Aucun commentaire:

Enregistrer un commentaire