[3.2] Improve thread IDs to avoid collisions with threads not created by the Godot API.

This commit is contained in:
bruvzg
2021-03-07 10:09:02 +02:00
parent b993febf28
commit ce11f7fa3e
2 changed files with 17 additions and 16 deletions

View File

@ -62,9 +62,10 @@ private:
friend class Main;
static ID main_thread_id;
static SafeNumeric<ID> last_thread_id;
ID id;
static uint64_t _thread_id_hash(const std::thread::id &p_t);
ID id = _thread_id_hash(std::thread::id());
static thread_local ID caller_id;
std::thread thread;
@ -97,7 +98,6 @@ public:
///< waits until thread is finished, and deallocates it.
void wait_to_finish();
Thread();
~Thread();
#else
_FORCE_INLINE_ ID get_id() const { return 0; }