diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-09-21 09:39:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 09:39:37 +0200 |
commit | fd5a496f1faba79b4a43dd329e33e7e474ac6493 (patch) | |
tree | be5d259a705f1ebe3681016961958671c1a4112a | |
parent | b323660fe8003d14fb0580aa038830aac4826493 (diff) | |
parent | 1529bf7c1050d677dc8ad6c4a077ed9922d02ceb (diff) |
Merge pull request #47815 from Calinou/doc-os-delay-nonblocking
Document how to delay code execution in a non-blocking manner
-rw-r--r-- | doc/classes/OS.xml | 8 |
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"> |