]> git.proxmox.com Git - wasi-libc.git/blame - libc-top-half/musl/src/thread/pthread_mutex_destroy.c
threads: implement support for pthread mutexes (#315)
[wasi-libc.git] / libc-top-half / musl / src / thread / pthread_mutex_destroy.c
CommitLineData
322bd4ff 1#include "pthread_impl.h"
320054e8
DG
2
3int pthread_mutex_destroy(pthread_mutex_t *mutex)
4{
33c3753c 5#ifdef __wasilibc_unmodified_upstream
322bd4ff
DG
6 /* If the mutex being destroyed is process-shared and has nontrivial
7 * type (tracking ownership), it might be in the pending slot of a
8 * robust_list; wait for quiescence. */
9 if (mutex->_m_type > 128) __vm_wait();
33c3753c
AB
10#else
11 /* For now, wasi-libc chooses to avoid implementing robust mutex support
12 * though this could be added later. The error code indicates that the
13 * mutex was an invalid type, but it would be more accurate as
14 * "unimplemented". */
15 if (mutex->_m_type > 128) return EINVAL;
16#endif
320054e8
DG
17 return 0;
18}