Can somebody please help me? I'm getting this assertion:
Assertion !(prefix().extra_state & es_ref_count_active) failed on line 211 of file ../../src
/tbb/task.cpp
Detailed description: ref_count race detected
tbb40_20120613oss, boost_1_49_0, Visual Studio 2010, Windows 7 SP1, Core i7 860
[cpp]int main(int argc, char *argv[])
{
tbb::parallel_for (0, 2000000000, [](int p_task_id)
{
if (p_task_id==0)
{
int sum = 0;
boost::thread user_thread([∑]
{
for (int i=0; i<10000; ++i)
for (int j=0; j<100000; ++j)
sum += (i*j)%7;
});
std::cout << sum;
}
else
{
if (p_task_id%1000000==0)
std::cerr << ".";
}
});
}[/cpp]
EDIT:
I made sure that only one thread is created inside parallel_for. The same assertion still shows up.
EDIT:
sum is now declared inside user_thread. Still the same assertion.
EDIT:
undo my last change. I was wrong. moving sum into user_thread fixed the problem.