Skip to content

Fix single-threaded recursive mutex locking#777

Open
Destructor17 wants to merge 2 commits intoWebAssembly:mainfrom
webrogue-runtime:single-thrd-rec-mutex-fix
Open

Fix single-threaded recursive mutex locking#777
Destructor17 wants to merge 2 commits intoWebAssembly:mainfrom
webrogue-runtime:single-thrd-rec-mutex-fix

Conversation

@Destructor17
Copy link

I have found this tiny mistake while investigating why pthread_mutex_lock return EDEADLK for recursive mutexes in single-threaded runtimes.

@sbc100
Copy link
Member

sbc100 commented Mar 21, 2026

Nice catch. For a moment I thought this was a bug in musl but I guess this code is wasi-libc-specific. (I see the musl code always does (type&3) == PTHREAD_MUTEX_RECURSIVE).

@alexcrichton
Copy link
Collaborator

Thanks! Could you add a test for this too?

@Destructor17 Destructor17 force-pushed the single-thrd-rec-mutex-fix branch from 272c6c1 to 065a858 Compare March 23, 2026 11:41
@Destructor17 Destructor17 force-pushed the single-thrd-rec-mutex-fix branch from 065a858 to 5374258 Compare March 23, 2026 11:41
@Destructor17
Copy link
Author

Could you add a test for this too?

Yeah, just added a simple test for this.

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.

3 participants