1 #include "pthread_impl.h" 2 pthread_mutex_destroy(pthread_mutex_t * mutex)3int pthread_mutex_destroy(pthread_mutex_t *mutex) 4 { 5 /* If the mutex being destroyed is process-shared and has nontrivial 6 * type (tracking ownership), it might be in the pending slot of a 7 * robust_list; wait for quiescence. */ 8 int type = mutex->_m_type; 9 if (type > 128) __vm_wait(); 10 if (__is_mutex_destroyed(type)) 11 __handle_using_destroyed_mutex(mutex, __FUNCTION__); 12 a_store(&mutex->_m_type, PTHREAD_MUTEX_DESTROYED); 13 return 0; 14 } 15