You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Remove thread after use to prevent memory leak
This commit is contained in:
@@ -71,7 +71,7 @@ public:
|
|||||||
static Error set_name(const String &p_name);
|
static Error set_name(const String &p_name);
|
||||||
_FORCE_INLINE_ static ID get_main_id() { return _main_thread_id; } ///< get the ID of the main thread
|
_FORCE_INLINE_ static ID get_main_id() { return _main_thread_id; } ///< get the ID of the main thread
|
||||||
static ID get_caller_id(); ///< get the ID of the caller function ID
|
static ID get_caller_id(); ///< get the ID of the caller function ID
|
||||||
static void wait_to_finish(Thread *p_thread); ///< waits until thread is finished, and deallocates it.
|
static void wait_to_finish(Thread *p_thread); ///< waits until thread is finished
|
||||||
static Thread *create(ThreadCreateCallback p_callback, void *p_user, const Settings &p_settings = Settings()); ///< Static function to create a thread, will call p_callback
|
static Thread *create(ThreadCreateCallback p_callback, void *p_user, const Settings &p_settings = Settings()); ///< Static function to create a thread, will call p_callback
|
||||||
|
|
||||||
virtual ~Thread();
|
virtual ~Thread();
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ bool LightmapperCPU::_parallel_run(int p_count, const String &p_description, Bak
|
|||||||
}
|
}
|
||||||
thread_cancelled = cancelled;
|
thread_cancelled = cancelled;
|
||||||
Thread::wait_to_finish(runner_thread);
|
Thread::wait_to_finish(runner_thread);
|
||||||
|
memdelete(runner_thread);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
thread_cancelled = false;
|
thread_cancelled = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user