I create a thread in a class member method like this:
void MyClass::startThread()
{
T.reset( new std::thread( &MyClass::myThreadMethod, this ) );
}
void MyClass::myThreadMethod()
{
// ...
}
where
// In header file
std::unique_ptr<std::thread> T;
When I run MyClass::startThread()
, I receive this:
Signal received: SIGABRT (Aborted) ...
If I step the code, it happens in the thread constructor.
I tried to removed the unique_ptr
like this:
void MyClass::startThread()
{
std::thread* T = new std::thread( &MyClass::myThreadMethod, this );
}
and the same thing occurred. I use gcc 4.8.2 on NetBeans 7.4 on Linux/Kubuntu 12.04.
Someone knows what happens?