mirror of
https://github.com/tiennm99/godot.git
synced 2026-08-29 20:24:04 +00:00
Add an OS.get_thread_caller_id() method
This can be used to print thread IDs in logs. This can make it easier
to debug multi-threaded applications.
Co-authored-by: Khaos <khaos@khaos-coders.org>
(cherry picked from commit 35b046ddf7)
This commit is contained in:
@@ -647,6 +647,10 @@ int _OS::get_power_percent_left() {
|
||||
return OS::get_singleton()->get_power_percent_left();
|
||||
}
|
||||
|
||||
Thread::ID _OS::get_thread_caller_id() const {
|
||||
return Thread::get_caller_id();
|
||||
};
|
||||
|
||||
bool _OS::has_feature(const String &p_feature) const {
|
||||
|
||||
return OS::get_singleton()->has_feature(p_feature);
|
||||
@@ -1416,6 +1420,7 @@ void _OS::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("alert", "text", "title"), &_OS::alert, DEFVAL("Alert!"));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_thread_name", "name"), &_OS::set_thread_name);
|
||||
ClassDB::bind_method(D_METHOD("get_thread_caller_id"), &_OS::get_thread_caller_id);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_use_vsync", "enable"), &_OS::set_use_vsync);
|
||||
ClassDB::bind_method(D_METHOD("is_vsync_enabled"), &_OS::is_vsync_enabled);
|
||||
|
||||
Reference in New Issue
Block a user