This is task.cpp::1987
Thanks a bunch!
Can you be more descriptive of your scheduler configuration? Are you creating more than one task_scheduler_init object at a time? The only way I can see this ASSERT being triggered is if on the last call to terminate (hitting zero in the reference count), the task pool allocated to the scheduler has already gone away. That's not a behavior you should ever see with a simple, single task_scheduler_init object living in the scope of main, so your code must be doing something funky. Any hints at what that might be will help us try to figure out how your code is landing in this unexpected trap.
And, oh, as a lark you might try the latest stable TBB release in the unlikely case this is running into some old bug. The ASSERT you mention occurs on line 3201 of my copy of task.cpp, so I think there have been a lot of changes since the version you appear to be using.
... In writing this, maybe we should see if we could explicitly lock the scheduler and test this theory.
Any thoughts or advice?