Jump to content

How thread-safe is WorldNode::getIntersection


photo

Recommended Posts

I have the following situation:

In my application there are 2 important threads (there are more, but only 2 are involved in the application): One thread that periodically calls WorldNode::getIntersection (well, it calls WorldInterface::getIntersection) in order to perform calculations based on the location of the player and another thread that does everything else (rendering, drawing graphics, handling user input, etc).

The application crashes at random (sometimes after 5 minutes, sometimes after an hour), but a core dump always reveals that the crash was caused by a SIGABRT raised from WorldNode::getIntersection.

Since this happens at random, I figure its thread-related (i.e.: Thread1 is calling a getIntersection, just as Thread2 is updating something).

Can someone verify / refute this. Alternate theories on why this happens are welcome.

I'm using Unigine V2.3.

Link to comment

Hi kbrodie,

You are correct, World::getIntersection is not thread save, it uses spatial tree, that can be changed while engine is updating and unfortunately there are no locks there.  You can add lock for calling this function and for engine update function, or just call it from engine thread.

Link to comment
×
×
  • Create New...