diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2023-05-23 23:28:47 +0200 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2023-05-24 00:22:58 +0200 |
commit | e725b4b02b60c9e8590cf7bff068f65074947fe9 (patch) | |
tree | 7e3cd51cb4a83faf95c4e3459abe9a86995e8f23 /main | |
parent | 809a98216267f3066b9fec2f02b2042bdc9d3e0d (diff) | |
download | redot-engine-e725b4b02b60c9e8590cf7bff068f65074947fe9.tar.gz |
Allow threads to mark themselves as safe for nodes
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp index 17e4f69ef2..94fb7ecdfa 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -512,6 +512,7 @@ void Main::print_help(const char *p_binary) { // are initialized here. This also combines `Main::setup2()` initialization. Error Main::test_setup() { Thread::make_main_thread(); + set_current_thread_safe_for_nodes(true); OS::get_singleton()->initialize(); @@ -723,6 +724,7 @@ int Main::test_entrypoint(int argc, char *argv[], bool &tests_need_run) { Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_phase) { Thread::make_main_thread(); + set_current_thread_safe_for_nodes(true); OS::get_singleton()->initialize(); @@ -1990,6 +1992,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph engine->startup_benchmark_end_measure(); // core Thread::release_main_thread(); // If setup2() is called from another thread, that one will become main thread, so preventively release this one. + set_current_thread_safe_for_nodes(false); if (p_second_phase) { return setup2(); @@ -2055,6 +2058,7 @@ error: Error Main::setup2() { Thread::make_main_thread(); // Make whatever thread call this the main thread. + set_current_thread_safe_for_nodes(true); // Print engine name and version print_line(String(VERSION_NAME) + " v" + get_full_version_string() + " - " + String(VERSION_WEBSITE)); |