]> git.proxmox.com Git - wasi-libc.git/commit
threads: implement support for pthread mutexes (#315)
authorAndrew Brown <andrew.brown@intel.com>
Mon, 22 Aug 2022 15:39:44 +0000 (08:39 -0700)
committerGitHub <noreply@github.com>
Mon, 22 Aug 2022 15:39:44 +0000 (08:39 -0700)
commit33c3753caf32b7d456e7e6801d9037f1f6f24ba9
treec27483694642b5098efd98005d9ea31618f2778c
parentdcd28cf8f6db612d8f71f2f9ca6bb6b4e46451b8
threads: implement support for pthread mutexes (#315)

This change adds pthread's mutex support to the `THREAD_MODEL=posix`
build of wasi-libc. Some less-common features are unsupported and
documented here:
- mutex robust lists are disabled and their use will return a runtime
  error; currently WASI does not support the concept of multiple
  processes so maintaining robust mutexes across processes does not yet
  make sense in wasi-libc
- timed locks with priority inheritance (PI) are disabled and will act
  as any other mutex; this feature is related to task priorities which
  is not yet relevant in the WASI ecosystem (see [priority-inheritance
  futexes](https://man7.org/linux/man-pages/man2/futex.2.html))
- thread cancellation is ignored; this feature is difficult to support
  and @sunfishcode would likely want to discuss this before adding it at
  some later time.
14 files changed:
Makefile
expected/wasm32-wasi/posix/defined-symbols.txt
expected/wasm32-wasi/posix/undefined-symbols.txt
libc-top-half/musl/src/internal/pthread_impl.h
libc-top-half/musl/src/internal/syscall.h
libc-top-half/musl/src/thread/__timedwait.c
libc-top-half/musl/src/thread/__wait.c
libc-top-half/musl/src/thread/pthread_mutex_destroy.c
libc-top-half/musl/src/thread/pthread_mutex_timedlock.c
libc-top-half/musl/src/thread/pthread_mutex_trylock.c
libc-top-half/musl/src/thread/pthread_mutex_unlock.c
libc-top-half/musl/src/thread/pthread_mutexattr_setprotocol.c
libc-top-half/musl/src/thread/pthread_mutexattr_setrobust.c
libc-top-half/musl/src/thread/thrd_sleep.c