master
 1#include "pthread_impl.h"
 2
 3int pthread_mutex_destroy(pthread_mutex_t *mutex)
 4{
 5#ifdef __wasilibc_unmodified_upstream
 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();
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
17	return 0;
18}