You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/performance/thread_safe_apis.rst
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,6 +109,26 @@ on separate threads (making them thread-safe), enable the following project sett
109
109
- **PhysicsServer2D:** :ref:`Physics > 2D > Run on Separate Thread <class_ProjectSettings_property_physics/2d/run_on_separate_thread>`.
110
110
- **PhysicsServer3D:** :ref:`Physics > 3D > Run on Separate Thread <class_ProjectSettings_property_physics/3d/run_on_separate_thread>`.
111
111
112
+
Navigation
113
+
----------
114
+
115
+
:ref:`NavigationServer2D<class_NavigationServer2D>` and :ref:`NavigationServer3D<class_NavigationServer3D>` are both thread-safe and thread-friendly.
116
+
117
+
The navigation-related query functions can be called by threads and run in true parallel.
118
+
119
+
By default, a conservative number of threads is supported running in true parallel on navigation maps before
120
+
additional threads have to wait for map data access at a semaphore.
121
+
To increase the number of threads that can run simultaneously on map data,
122
+
set :ref:`Navigation > Pathfinding > Max Threads <class_ProjectSettings_property_navigation/pathfinding/max_threads>`.
123
+
124
+
The navigation server-related resources like NavigationSourceGeometryData, NavigationMesh, and NavigationPolygon are all thread-safe but not necessarily thread-friendly.
125
+
They use internal read-write locks for thread-safety so editing the same resource (e.g. a single big navmesh) on multiple threads at the same time can cause thread congestion.
126
+
127
+
The navigation-related helper classes like :ref:`AStar2D<class_AStar2D>`, :ref:`AStar3D<class_AStar3D>`, and :ref:`AStarGrid2D<class_AStarGrid2D>` are **not** thread-safe.
128
+
They can be used with threads to some limited capacity, but using two or more threads on the same AStar object causes corruption.
129
+
For example, using a dedicated background thread per AStar object to populate points or do queries works,
130
+
but two threads using the same AStar object would corrupt each other's data.
0 commit comments