You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-24 15:26:15 +00:00
Modernize Thread
- Based on C++11's `thread` and `thread_local` - No more need to allocate-deallocate or check for null - No pointer anymore, just a member variable - Platform-specific implementations no longer needed (except for the few cases of non-portable functions) - Simpler for `NO_THREADS` - Thread ids are now the same across platforms (main is 1; others follow)
This commit is contained in:
@@ -269,7 +269,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
|
||||
Vector<Device> devices;
|
||||
volatile bool devices_changed;
|
||||
Mutex device_lock;
|
||||
Thread *check_for_changes_thread;
|
||||
Thread check_for_changes_thread;
|
||||
volatile bool quit_request;
|
||||
|
||||
static void _check_for_changes_poll_thread(void *ud) {
|
||||
@@ -2848,13 +2848,12 @@ public:
|
||||
devices_changed = true;
|
||||
plugins_changed = true;
|
||||
quit_request = false;
|
||||
check_for_changes_thread = Thread::create(_check_for_changes_poll_thread, this);
|
||||
check_for_changes_thread.start(_check_for_changes_poll_thread, this);
|
||||
}
|
||||
|
||||
~EditorExportPlatformAndroid() {
|
||||
quit_request = true;
|
||||
Thread::wait_to_finish(check_for_changes_thread);
|
||||
memdelete(check_for_changes_thread);
|
||||
check_for_changes_thread.wait_to_finish();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user