I rencently updated my development environment from Intel C++ Studio XE 2013 Beta to the release version. This new version comes with TBB 4.1, and now the application I've been working on for over a year decides to lockup when closing. Such behavior did not occur with previous versions of TBB, up to the version released along with the Beta (initial release, as I did not update it afterwards while still in Beta).
It may be worth noting that what makes use of TBB is a COM DLL. When DllMain is called with DLL_PROCESS_ATTACH, a static pointer to a task_scheduler_init is initialized. When DllMain is called with DLL_PROCESS_DETACH, the pointer is deleted. The deletion is where things start to go wrong now.
Here's the call stack up to the locking place:
> tbb_debug.dll!tbb::internal::binary_semaphore::V() Line 91 + 0x11 bytes C++
tbb_debug.dll!rml::internal::thread_monitor::notify() Line 186 C++
tbb_debug.dll!tbb::internal::rml::private_worker::start_shutdown() Line 241 + 0xb bytes C++
tbb_debug.dll!tbb::internal::rml::private_server::request_close_connection(bool __formal) Line 186 + 0x11 bytes C++
tbb_debug.dll!tbb::internal::market::release() Line 139 C++
tbb_debug.dll!tbb::internal::market::try_destroy_arena(tbb::internal::market * m, tbb::internal::arena * a, unsigned int aba_epoch, bool master) Line 212 C++
tbb_debug.dll!tbb::internal::arena::on_thread_leaving<1>() Line 343 + 0x13 bytes C++
tbb_debug.dll!tbb::internal::generic_scheduler::cleanup_master() Line 1109 C++
tbb_debug.dll!tbb::internal::governor::terminate_scheduler(tbb::internal::generic_scheduler * s) Line 167 C++
tbb_debug.dll!tbb::task_scheduler_init::terminate() Line 308 + 0x9 bytes C++
dllname.dll!tbb::task_scheduler_init::~task_scheduler_init() Line 111 C++
dllname.dll!tbb::task_scheduler_init::`scalar deleting destructor'() + 0x16 bytes C++
What's also worth noting is that the issue does not seem to occur if no TBB function in particular is called (like parallel_for).
I hope you can shed some light into this serious issue.