Hi all,
I want to do raycasts from many threads simultaneously.
While doing so, NO 'world update' will happen and no changes on any object.
(maybe some debugdraw but I can eliminate that too if it helps).
Is this (multi-threaded raycasting on a single world) thread-safe?
Will I get the correct ray hits?
Thanks
T
rayTest from multiple threads? Is it safe?
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: rayTest from multiple threads? Is it safe?
If you make the calls before stepping the world, nothing should change (assuming you don't add/remove/move anything yourself), and I've had relatively good experiences with read-only functions. Is it truly thread safe? Probably not unless Erwin posts here or comments in the code, though you can test to see if it's good enough if you use VS2013 and watch your threads in parallel.varoudis wrote:Hi all,
I want to do raycasts from many threads simultaneously.
While doing so, NO 'world update' will happen and no changes on any object.
(maybe some debugdraw but I can eliminate that too if it helps).
Is this (multi-threaded raycasting on a single world) thread-safe?
Will I get the correct ray hits?
Thanks
T
-
- Posts: 9
- Joined: Mon Jan 17, 2011 11:10 pm
Re: rayTest from multiple threads? Is it safe?
In my experience, no, unless something has changed recently.
If you find it to be thread safe, let us know!
I would like to do some raycasts for ambient occlusion testing in the background while generating terrain.
If you find it to be thread safe, let us know!
I would like to do some raycasts for ambient occlusion testing in the background while generating terrain.
-
- Posts: 5
- Joined: Sat Jan 22, 2011 11:24 am
Re: rayTest from multiple threads? Is it safe?
thats not good
Maybe Erwin can confirm?
At least without doing any world step or world modification, it should be thread safe.
Thanks
T
Maybe Erwin can confirm?
At least without doing any world step or world modification, it should be thread safe.
Thanks
T
-
- Posts: 149
- Joined: Fri May 24, 2013 6:08 am
Re: rayTest from multiple threads? Is it safe?
You cannot be raycasting from one thread while you are stepping the world in another. There is a class called SpuBatchRaycaster which seems to allow a batch of raycasts to be performed across multiple threads, though I have never tested it. It is in a few of the example apps ... search for:
#ifdef BATCH_RAYCASTER
#ifdef BATCH_RAYCASTER
-
- Posts: 5
- Joined: Sat Jan 22, 2011 11:24 am
Re: rayTest from multiple threads? Is it safe?
thanks c6, ill look for it.
of course Im not doing ANY step/update from ANY thread during multi-threaded casting.
of course Im not doing ANY step/update from ANY thread during multi-threaded casting.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: rayTest from multiple threads? Is it safe?
The ray cast should be treadsafe/re-entrant, as long as you don't step/change the world during the ray cast.
If not, please report back,
Erwin
If not, please report back,
Erwin