Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2473 Discussions

tbb::mutex in object in vector causes critical error

P_A__Jimenez
Beginner
548 Views
I have some code that fills in a std::vector with some Job objects (std::vector). Each Job object has a tbb::mutex mMutexes[2]member. No mutex is being used at all, yet. Thing is, once the vector goes out of scope, causing all Jobs to be destroyed, a Critical Error occurs pointing to internal_destroy() inside tbb::mutex's destructor.

Changing from tbb::mutex to tbb::spin_mutex does not cause any issues.

In case tbb::mutex cannot be assigned (as it may happen during a std::vector resize()), should not it be disallowed in the first place? In case it should work, do you have any ideas why that code causes such an error?

Thanks.
0 Kudos
1 Reply
Alexey-Kukanov
Employee
548 Views

You are right in the assumption that mutexes should not be assigned or copied, andthat it should be disallowed. It can be considered a bug we need to fix.

0 Kudos
Reply