diff options
| author | Rémi Verschelde <remi@verschelde.fr> | 2023-05-11 10:55:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-11 10:55:31 +0200 |
| commit | fbb1a929a374b3d95c198dd40c896c928d8f6162 (patch) | |
| tree | a841ad4e1f3d7841a34eed964b237fbae0fb5d1b /core/os/thread.cpp | |
| parent | c80a2b4fe99dcd0bba6fc24ed2748b1474b24448 (diff) | |
| parent | 045401c64ee020dc7e71f793b2b6fbe25f05816a (diff) | |
| download | redot-engine-fbb1a929a374b3d95c198dd40c896c928d8f6162.tar.gz | |
Merge pull request #74405 from RandomShaper/fix_res_loader
Fix multi-threaded resource loading
Diffstat (limited to 'core/os/thread.cpp')
| -rw-r--r-- | core/os/thread.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/os/thread.cpp b/core/os/thread.cpp index 502f82aaef..c067ad1a6a 100644 --- a/core/os/thread.cpp +++ b/core/os/thread.cpp @@ -66,11 +66,12 @@ void Thread::callback(ID p_caller_id, const Settings &p_settings, Callback p_cal } } -void Thread::start(Thread::Callback p_callback, void *p_user, const Settings &p_settings) { - ERR_FAIL_COND_MSG(id != UNASSIGNED_ID, "A Thread object has been re-started without wait_to_finish() having been called on it."); +Thread::ID Thread::start(Thread::Callback p_callback, void *p_user, const Settings &p_settings) { + ERR_FAIL_COND_V_MSG(id != UNASSIGNED_ID, UNASSIGNED_ID, "A Thread object has been re-started without wait_to_finish() having been called on it."); id = id_counter.increment(); std::thread new_thread(&Thread::callback, id, p_settings, p_callback, p_user); thread.swap(new_thread); + return id; } bool Thread::is_started() const { |
