You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Use OS::delay_usec() to avoid using deprecated usleep() on Linux
usleep(3) was declared obsolete in POSIX.1-2001 and removed in POSIX.1-2008. nanosleep(2) was recommended to be used instead. `OS::delay_usec()` internally uses `nanosleep()`. This also uses large number separators for improved readability.
This commit is contained in:
@@ -225,7 +225,7 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
|
||||
udev_device_unref(dev);
|
||||
}
|
||||
}
|
||||
usleep(50000);
|
||||
OS::get_singleton()->delay_usec(50'000);
|
||||
}
|
||||
udev_monitor_unref(mon);
|
||||
}
|
||||
@@ -250,7 +250,7 @@ void JoypadLinux::monitor_joypads() {
|
||||
}
|
||||
}
|
||||
closedir(input_directory);
|
||||
usleep(1000000); // 1s
|
||||
OS::get_singleton()->delay_usec(1'000'000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,7 +508,7 @@ void JoypadLinux::joypad_events_thread_run() {
|
||||
}
|
||||
}
|
||||
if (no_events) {
|
||||
usleep(10000); // 10ms
|
||||
OS::get_singleton()->delay_usec(10'000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user