About Store Forum Documentation Contact
Donations:
225$/mo



Post Reply 
Is PathObstacle.create() Thread Safe?
Author Message
fatcoder Offline
Member

Post: #1
Is PathObstacle.create() Thread Safe?
I'm using MultiThreadedCall() to run a method that needs to create a lot of PathObstacles. However, sometimes it will crash (with an access violation) on the call to create() for some random PathObstacle. It seems to be completely random, i.e. it works fine most of the time, So I'm guessing one thread is trying to create a PathObstacle on a PathWorld at the same time as another thread.

If I create all the PathObstacles without using MultiThreadedCall(), then I don't seem to run into the problem. It just a lot slower.

If it isn't thread safe, any chance of making it thread safe? I know I can use CritSect, but was hoping it could be thread safe by default in EE.
02-15-2013 09:27 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #2
RE: Is PathObstacle.create() Thread Safe?
I've run into this issue sometime last year. If you are using 1.0, then PhysX 2.x, then those calls aren't threadsafe. Moving to PhysX 3.x is suppose to give us multithreading capabilities. I'm sure EE will elaborate more.
02-15-2013 02:41 PM
Visit this user's website Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #3
RE: Is PathObstacle.create() Thread Safe?
Thanks for the reply, but unfortunately this has nothing to do with PhysX. I'm talking about the recast nav mesh obstacles.
02-16-2013 01:22 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #4
RE: Is PathObstacle.create() Thread Safe?
Ahh yes, you are right, this isn't related to PhysX at all :-p. After revisiting this code, even CritSect didn't help the random crashes. If you end up going that direction (and I think you likely will), and get it working using CritSect or some other manner, please do let me know.
(This post was last modified: 02-16-2013 02:28 AM by aceio76.)
02-16-2013 01:28 AM
Visit this user's website Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #5
RE: Is PathObstacle.create() Thread Safe?
I'll wait to hear from Esenthel before pursuing that.
02-16-2013 02:03 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Is PathObstacle.create() Thread Safe?
This func is not multi threaded safe
It should be called only on main thread
Multi threaded improvement of that func is on the roadmap
02-19-2013 11:23 AM
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #7
RE: Is PathObstacle.create() Thread Safe?
OK, thanks. It will be a major help. At the moment, creating obstacles in a multi threaded environment is a real hit and miss thing. Sometimes, they create, sometimes they don't other times you just get access violations. Looking forward to it.
02-26-2013 02:10 AM
Find all posts by this user Quote this message in a reply
Post Reply