summaryrefslogtreecommitdiff
path: root/core/os
diff options
context:
space:
mode:
Diffstat (limited to 'core/os')
-rw-r--r--core/os/os.h3
-rw-r--r--core/os/thread.cpp1
2 files changed, 3 insertions, 1 deletions
diff --git a/core/os/os.h b/core/os/os.h
index 77a54ba68a..e41d788e12 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -40,6 +40,7 @@
#include "core/templates/vector.h"
#include <stdarg.h>
+#include <stdlib.h>
class OS {
static OS *singleton;
@@ -53,7 +54,7 @@ class OS {
bool _debug_stdout = false;
String _local_clipboard;
bool _no_window = false;
- int _exit_code = 0;
+ int _exit_code = EXIT_FAILURE; // unexpected exit is marked as failure
int _orientation;
bool _allow_hidpi = false;
bool _allow_layered = false;
diff --git a/core/os/thread.cpp b/core/os/thread.cpp
index 88744eed63..aea370787d 100644
--- a/core/os/thread.cpp
+++ b/core/os/thread.cpp
@@ -92,6 +92,7 @@ bool Thread::is_started() const {
void Thread::wait_to_finish() {
if (id != 0) {
+ ERR_FAIL_COND_MSG(id == get_caller_id(), "A Thread can't wait for itself to finish.");
thread.join();
std::thread empty_thread;
thread.swap(empty_thread);