mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-13 16:31:29 -10:00
Both drivers park a poll thread on a flag the teardown sets from another thread, with no lock either side, as volatile bools that ordered nothing between the two. The flags are initialised before their thread is created, and on the Wii USB side before the first goto error, since free stores through it. wiiusb_hid's device_detected goes the other way. It is raised by wiiusb_hid_change_cb, which libogc runs in interrupt context, so an atomic is not what it wants - the writer is not a thread, and this file's other interrupt-shared state is volatile for that reason. It was a plain bool, which left the poll thread free to hold it in a register across the loop; volatile is the smallest thing that fixes that. Both files build against the headers already in the tree - libogc under wii/, wut under wiiu/ - on a 32-bit PowerPC compiler and on all five retro_atomic backends, unmodified first and then with the change.