added warning when deleting a thread that isnot finished

This commit is contained in:
csoler 2019-05-12 10:46:08 +02:00
parent 7b2541e35c
commit 1cee069243
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 11 additions and 1 deletions

View File

@ -103,6 +103,16 @@ RsThread::RsThread()
mShouldStopSemaphore.set(0) ; mShouldStopSemaphore.set(0) ;
} }
RsThread::~RsThread()
{
if(isRunning())
{
std::cerr << "(EE) Deleting a thread that is actually running! Something is very wrong here:" << std::endl;
print_stacktrace();
}
}
bool RsThread::isRunning() bool RsThread::isRunning()
{ {
// do we need a mutex for this ? // do we need a mutex for this ?

View File

@ -243,7 +243,7 @@ class RsThread
{ {
public: public:
RsThread(); RsThread();
virtual ~RsThread() {} virtual ~RsThread() ;
void start(const std::string &threadName = ""); void start(const std::string &threadName = "");