Skip to content

Conversation

@cwoffenden
Copy link
Collaborator

@cwoffenden cwoffenden commented Feb 22, 2025

  • spinlocks fixed so they work in audio worklets
  • adds tests for various spinlock cases
  • test converted to C-only (still in a C++ file for now, see below)

This was unmerged last year (#22995), visited again now the browser tests are running with audio. It's been moved over to btest_exit() and verified that it runs (and will only exit after all tests have run or asserted).

The only change I'd make is to rename the original test file, which has grown beyond its original use. A git mv command won't survive multiple commits, so I want to either leave it until last, live with the resulting deletion, or rename as a separate PR.

Fixes: #22962

@cwoffenden cwoffenden changed the title [AudioWorklets] Enable AW spinlocks, verifies them in browser test [AUDIO_WORKLET] Enable AW spinlocks, verify them in the browser tests Feb 22, 2025
@cwoffenden cwoffenden force-pushed the cw-audio-spinlock-refix branch from 0b71d81 to af3d551 Compare February 24, 2025 17:42
def test_audio_worklet_emscripten_futex_wake(self):
self.btest('webaudio/audioworklet_emscripten_futex_wake.cpp', expected='0', args=['-sAUDIO_WORKLET', '-sWASM_WORKERS', '-pthread', '-sPTHREAD_POOL_SIZE=2'])
def test_audio_worklet_emscripten_locks(self):
self.btest_exit('webaudio/audioworklet_emscripten_futex_wake.cpp', args=['-sAUDIO_WORKLET', '-sWASM_WORKERS', '-pthread', '-sPTHREAD_POOL_SIZE=2'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this test actually start any pthreads? I.e. can we remove -sPTHREAD_POOL_SIZE?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll take a look tomorrow, I kept this from the original interactive test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove -sPTHREAD_POOL_SIZE but not -pthread (otherwise _emscripten_thread_supports_atomics_wait won't link).

Done, and also rebased to bring in the Firefox CI changes.

@cwoffenden cwoffenden force-pushed the cw-audio-spinlock-refix branch from a0ca317 to eed0ca2 Compare February 25, 2025 08:13
@sbc100 sbc100 requested a review from juj February 25, 2025 17:25
Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

CC'ing @juj in case he has some input.

@sbc100 sbc100 merged commit 273f021 into emscripten-core:main Feb 25, 2025
29 checks passed
@cwoffenden cwoffenden deleted the cw-audio-spinlock-refix branch February 25, 2025 17:36
kripken pushed a commit that referenced this pull request Feb 27, 2025
Performed as a separate step from #23729 to not lose the history. The
C++ file had already been converted to C as part of the previous PR,
this now updates the filename and its extension.
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.

Interactive audio worklet futex test fails

2 participants