Multithreading use tilecache #141
-
I need your some suggest. I need use main thread to update obstacle, then anther thread pools only findpath to improve speed. Becuse of concurrency problems, I will use CopyOnWriteArrayList replace ArrayList. Is that righe? I need your help. Navmesh.class And Will there be some other problems ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The library is not designed to handle navmesh updates and pathfinding concurrently. The place you mentioned could be made thread-safe but there might be other places to change too. Using CopyOnWriteArrayList will not work as it would also require replacing the reference to the list.
|
Beta Was this translation helpful? Give feedback.
The library is not designed to handle navmesh updates and pathfinding concurrently. The place you mentioned could be made thread-safe but there might be other places to change too. Using CopyOnWriteArrayList will not work as it would also require replacing the reference to the list.
The proper approach would be to use a Lock or a Semaphore to make sure navmesh updates do no overlap with ongoing path searches.
E.g.