Skip to content

Conversation

@GaryOderNichts
Copy link

AX initialization needs to be done on CPU1, otherwise interrupts won't be handled properly.
Previously this was attempted to be done using OSSetThreadAffinity, to change the affinity of the current thread.
Unfortunately OSSetThreadAffinity does not work when called for the currently running thread. This causes issues when opening an SDL audio device from a thread not running on CPU1.
This commit now creates a new thread running on CPU1 for AX initialization, and joins it before moving on.
Currently marked a draft until further testing is done.

AX initialization needs to be done on CPU1, otherwise interrupts won't be handled properly.
Previously this was attmpted to be done using `OSSetThreadAffinity` to change the affinity of the current thread.
Unfortunately `OSSetThreadAffinity` does not work when called for the currently running thread.
This caused issues when an SDL audio device was opened from a thread not running on CPU1.
This commit now creates a new thread running on CPU1 for AX initialization, and joins it before moving on.
@GaryOderNichts GaryOderNichts force-pushed the wiiu/audio/revise_thread_affinity branch from 85add52 to f09de25 Compare May 26, 2025 20:56
@GaryOderNichts GaryOderNichts marked this pull request as ready for review September 9, 2025 13:03
@GaryOderNichts GaryOderNichts changed the title wiiu/audio: Open device in new thread wiiu/audio: Open device in new thread if running on another core Sep 10, 2025
@GaryOderNichts GaryOderNichts merged commit 8810c2f into devkitPro:wiiu-sdl2-2.28 Sep 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant