mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 18:29:11 +00:00
Heading capitalization fixes + misc edits
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
Multi-Threading
|
||||
Multi-threading
|
||||
===============
|
||||
|
||||
.. toctree::
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.. _doc_thread_safe_apis:
|
||||
|
||||
Thread Safe APIs
|
||||
Thread safe APIs
|
||||
================
|
||||
|
||||
Threads
|
||||
@@ -11,14 +11,14 @@ Godot supports multi threading, but not in the whole engine.
|
||||
|
||||
Below is a list of the areas in Godot and how they can be used with threads.
|
||||
|
||||
Global Scope
|
||||
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!).
|
||||
|
||||
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
|
||||
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:
|
||||
@@ -39,8 +39,8 @@ However, creating scene chunks (nodes in tree arrangement) outside the active tr
|
||||
enemy.add_child(weapon) # Set a weapon.
|
||||
world.call_deferred("add_child", enemy)
|
||||
|
||||
GDScript Arrays, Dictionaries:
|
||||
------------------------------
|
||||
GDScript arrays, dictionaries
|
||||
-----------------------------
|
||||
|
||||
In GDScript, reading and writing elements from multiple threads is ok, but anything that changes the container size (resizing, adding or removing elements) requires locking a mutex.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user