|
@@ -1,6 +1,6 @@
|
|
|
.. _doc_thread_safe_apis:
|
|
|
|
|
|
-Thread safe APIs
|
|
|
+Thread-safe APIs
|
|
|
================
|
|
|
|
|
|
Threads
|
|
@@ -14,14 +14,14 @@ Below is a list of ways multithreading can be used in different areas of Godot.
|
|
|
Global scope
|
|
|
------------
|
|
|
|
|
|
-:ref:`Global Scope<class_@GlobalScope>` singletons are all thread safe. Accessing servers from threads is supported (for VisualServer and Physics servers, ensure threaded or thread safe operation is enabled in the project settings!).
|
|
|
+:ref:`Global Scope<class_@GlobalScope>` singletons are all thread-safe. Accessing servers from threads is supported (for VisualServer and Physics servers, ensure threaded or thread-safe operation is enabled in the project settings!).
|
|
|
|
|
|
This makes them ideal for code that creates dozens of thousands of instances in servers and controls them from threads. Of course, it requires a bit more code, as this is used directly and not within the scene tree.
|
|
|
|
|
|
Scene tree
|
|
|
----------
|
|
|
|
|
|
-Interacting with the active scene tree is **NOT** thread safe. Make sure to use mutexes when sending data between threads. If you want to call functions from a thread, the *call_deferred* function may be used:
|
|
|
+Interacting with the active scene tree is **NOT** thread-safe. Make sure to use mutexes when sending data between threads. If you want to call functions from a thread, the *call_deferred* function may be used:
|
|
|
|
|
|
::
|
|
|
|
|
@@ -44,7 +44,7 @@ Attempting to load or create scene chunks from multiple threads may work, but yo
|
|
|
resources (which are only loaded once in Godot) tweaked by the multiple
|
|
|
threads, resulting in unexpected behaviors or crashes.
|
|
|
|
|
|
-Only use more than one thread to generate scene data if you *really* know what
|
|
|
+Only use more than one thread to generate scene data if you *really* know what
|
|
|
you are doing and you are sure that a single resource is not being used or
|
|
|
set in multiple ones. Otherwise, you are safer just using the servers API
|
|
|
(which is fully thread-safe) directly and not touching scene or resources.
|