I'm running a small program built using TBB on Windows with mingw32. It does a parallel_for. Inside the parallel_for my object makes changes to a concurrent_hash_map object. It starts running but later throws a SIGSEGV when I try to use an accessor. I don't know where the problem is.
My object:
class Foobar
{
public:
Foobar(FoobarParent* rw) : _rw(rw)
{
_fooMap = &_rw->randomWalkers();
}
void operator() (const tbb::blocked_range<size_t>&r ) const
{
for(size_t i = r.begin(); i != r.end(); ++i)
{
apply(i);
}
}
private:
void apply(int i) const
{
pointMap_t::accessor a;
_fooMap->find(a, i);
Point3D current = a->second;
Point3D next = _rw->getNext(current);
if (!_rw->hasConstraint(next))
{
return;
}
a->second = next;
}
FoobarParent* _rw;
pointMap_t* _fooMap;
};
pointMap_t is defined as:
typedef tbb::concurrent_hash_map<int, Point3D> pointMap_t;
Can someone shed a light on this issue? I'm new to TBB. The signal is thrown when the apply method calls a->second.