Skip to content

threads: implement support for unnamed semaphores#316

Merged
abrown merged 2 commits intoWebAssembly:mainfrom
abrown:pthreads-semaphore
Aug 22, 2022
Merged

threads: implement support for unnamed semaphores#316
abrown merged 2 commits intoWebAssembly:mainfrom
abrown:pthreads-semaphore

Conversation

@abrown
Copy link
Copy Markdown
Collaborator

@abrown abrown commented Aug 22, 2022

POSIX semaphores come in two forms: named and unnamed. Roughly, named
semaphores use files to implement locking across processes; unnamed
semaphores use a shared memory region to implement locking across
threads in the same process. Since WASI currently has no process concept
(and it is relatively unclear how to map the WASI files as shared
memory), only the unnamed semaphores are supported by this changed. This
means that sem_open, sem_close, and sem_unlink will not available
to programs compiled with a threads-enabled wasi-libc.

@abrown abrown requested review from sbc100 and sunfishcode August 22, 2022 17:56
@abrown abrown force-pushed the pthreads-semaphore branch from 00b9418 to 6eccb77 Compare August 22, 2022 17:59
[POSIX semaphores] come in two forms: named and unnamed. Roughly, named
semaphores use files to implement locking across processes; unnamed
semaphores use a shared memory region to implement locking across
threads in the same process. Since WASI currently has no process concept
(and it is relatively unclear how to map the WASI files as shared
memory), only the unnamed semaphores are supported by this changed. This
means that `sem_open`, `sem_close`, and `sem_unlink` will not available
to programs compiled with a threads-enabled `wasi-libc`.

[POSIX semaphores]: https://man7.org/linux/man-pages/man7/sem_overview.7.html
@abrown abrown force-pushed the pthreads-semaphore branch from 6eccb77 to b8d0356 Compare August 22, 2022 18:00
Copy link
Copy Markdown
Member

@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 % comment

Comment thread libc-top-half/musl/src/thread/sem_timedwait.c Outdated
@abrown abrown merged commit 2057ce9 into WebAssembly:main Aug 22, 2022
@abrown abrown deleted the pthreads-semaphore branch August 22, 2022 21:22
john-sharratt pushed a commit to john-sharratt/wasix-libc that referenced this pull request Mar 6, 2023
[POSIX semaphores] come in two forms: named and unnamed. Roughly, named
semaphores use files to implement locking across processes; unnamed
semaphores use a shared memory region to implement locking across
threads in the same process. Since WASI currently has no process concept
(and it is relatively unclear how to map the WASI files as shared
memory), only the unnamed semaphores are supported by this changed. This
means that `sem_open`, `sem_close`, and `sem_unlink` will not available
to programs compiled with a threads-enabled `wasi-libc`.

[POSIX semaphores]: https://man7.org/linux/man-pages/man7/sem_overview.7.html
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