Skip to content

wasm2c: Fix platform specific mutex support#2566

Merged
shravanrn merged 1 commit into
WebAssembly:mainfrom
PLSysSec:tls-mtx-fix
Mar 19, 2025
Merged

wasm2c: Fix platform specific mutex support#2566
shravanrn merged 1 commit into
WebAssembly:mainfrom
PLSysSec:tls-mtx-fix

Conversation

@shravanrn

@shravanrn shravanrn commented Mar 19, 2025

Copy link
Copy Markdown
Collaborator

I started testing the wasm2c code a bit more on FreeBSD and found issues with using C11 mutexes. Unfortunately, the C11 mutex APIs seems to be supported almost nowhere. Apple doesn't support it, FreeBSD doesn't support it (hence wasm2c examples actually fail on FreeBSD until this change), Windows doesn't support it till very recently. We are better off simply relying on platform specific primitives: CRITICAL_SECTION on windows, pthread_mutex_t everywhere else.

@sbc100 sbc100 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sad to learn about the state of C11 threads.

@shravanrn shravanrn merged commit a27b480 into WebAssembly:main Mar 19, 2025
@shravanrn shravanrn deleted the tls-mtx-fix branch March 19, 2025 21:05
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.

2 participants