samedi 22 juillet 2017

Debug assertion failed error is seen while joining threads in C++ ( std::thread.join())

I'm quite new to multi-threading, hence please go a bit easy on me :)

I've 2 threads - 1 is a main thread & another one is a std::threads created from main thread.

There are many shared resourced, hence I have used mutexes (std::unique_lock) for all shared resources in both threads made sure that all shared resources are protected using locks/mutexes.

However, when i try to join the std::thread to main thread I get an error window stating:

Debug assertion Failed. Vector Iterators incompatible.

From Main Thread

if(childThread.joinable()) // here childThread is a std::thread() type thread 
                            // created from main thread
{
     childThread.join(); // I get this error when this  line is executed
}

This is really confusing as to why am I getting this error.

Aucun commentaire:

Enregistrer un commentaire