summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2021-04-12 00:10:17 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2021-09-21 02:15:25 +0200
commit1529bf7c1050d677dc8ad6c4a077ed9922d02ceb (patch)
treec998370641acb3d2efd6013e6a6f922bfc35e6c5 /doc
parent2d1699ef82a29ef65d810194ee76dddc0d9e0389 (diff)
Document how to delay code execution in a non-blocking manner
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/OS.xml8
1 files changed, 6 insertions, 2 deletions
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index 305258c8c5..f5a57ca1e3 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -55,14 +55,18 @@
<return type="void" />
<argument index="0" name="msec" type="int" />
<description>
- Delay execution of the current thread by [code]msec[/code] milliseconds. [code]msec[/code] must be greater than or equal to [code]0[/code]. Otherwise, [method delay_msec] will do nothing and will print an error message.
+ Delays execution of the current thread by [code]msec[/code] milliseconds. [code]msec[/code] must be greater than or equal to [code]0[/code]. Otherwise, [method delay_msec] will do nothing and will print an error message.
+ [b]Note:[/b] [method delay_msec] is a [i]blocking[/i] way to delay code execution. To delay code execution in a non-blocking way, see [method SceneTree.create_timer]. Yielding with [method SceneTree.create_timer] will delay the execution of code placed below the [code]yield[/code] without affecting the rest of the project (or editor, for [EditorPlugin]s and [EditorScript]s).
+ [b]Note:[/b] When [method delay_msec] is called on the main thread, it will freeze the project and will prevent it from redrawing and registering input until the delay has passed. When using [method delay_msec] as part of an [EditorPlugin] or [EditorScript], it will freeze the editor but won't freeze the project if it is currently running (since the project is an independent child process).
</description>
</method>
<method name="delay_usec" qualifiers="const">
<return type="void" />
<argument index="0" name="usec" type="int" />
<description>
- Delay execution of the current thread by [code]usec[/code] microseconds. [code]usec[/code] must be greater than or equal to [code]0[/code]. Otherwise, [method delay_usec] will do nothing and will print an error message.
+ Delays execution of the current thread by [code]usec[/code] microseconds. [code]usec[/code] must be greater than or equal to [code]0[/code]. Otherwise, [method delay_usec] will do nothing and will print an error message.
+ [b]Note:[/b] [method delay_usec] is a [i]blocking[/i] way to delay code execution. To delay code execution in a non-blocking way, see [method SceneTree.create_timer]. Yielding with [method SceneTree.create_timer] will delay the execution of code placed below the [code]yield[/code] without affecting the rest of the project (or editor, for [EditorPlugin]s and [EditorScript]s).
+ [b]Note:[/b] When [method delay_usec] is called on the main thread, it will freeze the project and will prevent it from redrawing and registering input until the delay has passed. When using [method delay_usec] as part of an [EditorPlugin] or [EditorScript], it will freeze the editor but won't freeze the project if it is currently running (since the project is an independent child process).
</description>
</method>
<method name="dump_memory_to_file">