tbb::mutex in object in vector causes critical error

tbb::mutex in object in vector causes critical error

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.

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Leave a Comment

Please sign in to add a comment. Not a member? Join today