1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-29 16:16:38 +00:00

Modernize atomics

- Based on C++11's `atomic`
- Reworked `SafeRefCount` (based on the rewrite by @hpvb)
- Replaced free atomic functions by the new `SafeNumeric<T>`
- Replaced wrong cases of `volatile` by the new `SafeFlag`
- Platform-specific implementations no longer needed

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
This commit is contained in:
Pedro J. Estébanez
2021-01-31 13:34:42 +01:00
parent 6d89f675b1
commit 4485b43a57
54 changed files with 641 additions and 676 deletions

View File

@@ -92,13 +92,12 @@ JoypadLinux::JoypadLinux(InputDefault *in) {
#else
print_verbose("JoypadLinux: udev disabled, parsing /dev/input to detect joypads.");
#endif
exit_monitor = false;
input = in;
joy_thread.start(joy_thread_func, this);
}
JoypadLinux::~JoypadLinux() {
exit_monitor = true;
exit_monitor.set();
joy_thread.wait_to_finish();
close_joypad();
}
@@ -172,7 +171,7 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
udev_monitor_enable_receiving(mon);
int fd = udev_monitor_get_fd(mon);
while (!exit_monitor) {
while (!exit_monitor.is_set()) {
fd_set fds;
struct timeval tv;
@@ -220,7 +219,7 @@ void JoypadLinux::monitor_joypads(udev *p_udev) {
void JoypadLinux::monitor_joypads() {
while (!exit_monitor) {
while (!exit_monitor.is_set()) {
joy_mutex.lock();
DIR *input_directory;